Logs: liberachat/#haskell
| 2021-07-25 12:04:20 | ← | jakalx parts (~jakalx@base.jakalx.net) () |
| 2021-07-25 12:10:26 | × | zeenk quits (~zeenk@2a02:2f04:a008:d600:18f2:3421:bac6:8f38) (Quit: Konversation terminated!) |
| 2021-07-25 12:12:02 | → | LukeHoersten joins (~LukeHoers@user/lukehoersten) |
| 2021-07-25 12:15:45 | × | dunkeln quits (~dunkeln@94.129.69.87) (Ping timeout: 265 seconds) |
| 2021-07-25 12:18:38 | → | eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-07-25 12:18:46 | → | jakalx joins (~jakalx@base.jakalx.net) |
| 2021-07-25 12:21:32 | → | Atum_ joins (~IRC@user/atum/x-2392232) |
| 2021-07-25 12:22:42 | × | eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 240 seconds) |
| 2021-07-25 12:32:33 | × | LukeHoersten quits (~LukeHoers@user/lukehoersten) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-07-25 12:35:02 | → | favonia joins (~favonia@user/favonia) |
| 2021-07-25 12:39:14 | → | curiousgay joins (~curiousga@77-120-186-48.kha.volia.net) |
| 2021-07-25 12:41:00 | → | xsperry joins (~as@user/xsperry) |
| 2021-07-25 12:42:40 | AlexNoo_ | is now known as AlexNoo |
| 2021-07-25 12:45:11 | → | eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) |
| 2021-07-25 12:45:52 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-07-25 12:49:33 | → | LukeHoersten joins (~LukeHoers@user/lukehoersten) |
| 2021-07-25 12:49:40 | × | eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 256 seconds) |
| 2021-07-25 12:53:06 | → | Gurkenglas joins (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de) |
| 2021-07-25 12:54:14 | × | burnsidesLlama quits (~burnsides@client-8-87.eduroam.oxuni.org.uk) (Remote host closed the connection) |
| 2021-07-25 12:55:40 | → | hacker1234 joins (~weijiafu@2409:8a74:c90:3400:2193:78b:c8a3:31b7) |
| 2021-07-25 12:56:15 | ← | hacker1234 parts (~weijiafu@2409:8a74:c90:3400:2193:78b:c8a3:31b7) () |
| 2021-07-25 13:00:56 | → | alx741 joins (~alx741@186.178.108.59) |
| 2021-07-25 13:05:01 | × | mjs2600 quits (~mjs2600@c-24-91-3-49.hsd1.vt.comcast.net) (Ping timeout: 258 seconds) |
| 2021-07-25 13:07:01 | × | Atum_ quits (~IRC@user/atum/x-2392232) (Quit: Atum_) |
| 2021-07-25 13:10:46 | × | curiousgay quits (~curiousga@77-120-186-48.kha.volia.net) (Ping timeout: 258 seconds) |
| 2021-07-25 13:11:56 | → | mjs2600 joins (~mjs2600@c-24-91-3-49.hsd1.vt.comcast.net) |
| 2021-07-25 13:16:32 | <arkanoid> | is it more idiomatic to do not pollute the module by defining function in "where" block of other functions, or there's a better way? |
| 2021-07-25 13:16:32 | → | __monty__ joins (~toonn@user/toonn) |
| 2021-07-25 13:17:49 | <Hecate> | arkanoid: the module is not polluted as long as you only export what needs to be exported |
| 2021-07-25 13:18:55 | <arkanoid> | Hecate: right, but is it still considereg good practice to control function visibility within a single module by embedding functions into where blocks? |
| 2021-07-25 13:19:53 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 252 seconds) |
| 2021-07-25 13:20:37 | <Logio> | you can't test a non-visible function, so I'd say that's bad practice more than anything |
| 2021-07-25 13:21:40 | → | tlaxkit joins (~hexchat@170.253.39.204) |
| 2021-07-25 13:22:39 | → | Atum_ joins (~IRC@user/atum/x-2392232) |
| 2021-07-25 13:24:28 | <Logio> | unless your function definition depends on the local scope there's hardly any benefits to it, and even then I usually find myself refactoring code to do the opposite, for the aforementioned reason |
| 2021-07-25 13:24:36 | <[exa]> | arkanoid: if the function doesn't benefit from sharing the parameter context with the bigger function, I'd just leave it at top level. If it looks polluted, add comments. |
| 2021-07-25 13:26:15 | <Hecate> | arkanoid: what [exa] and Logio said ^ |
| 2021-07-25 13:26:44 | <Hecate> | don't think too much about this, most of your library's consumers will take what you give them, and your code will largely stay unread |
| 2021-07-25 13:26:46 | <arkanoid> | it makes sense, an embedded function cannot be tested separately. Thanks! |
| 2021-07-25 13:26:48 | <[exa]> | there might not even be any extra considerations, except perhaps from possible memoization vs. monomorphism |
| 2021-07-25 13:28:14 | <[exa]> | well yea, if you can make it parameterless and reuse the result manu times, it might be much better in the where block. :] |
| 2021-07-25 13:33:17 | <arkanoid> | I've another noob question, if you don't mind. When writing functions I tend to start by using static types and make it work, and then after all the test passes I feel guilty not having used polymorphism and typeclasses. Is it considered "wrong" non using "a -> b" but "Int -> Float"? |
| 2021-07-25 13:33:35 | <[exa]> | not at all |
| 2021-07-25 13:33:46 | <[exa]> | that's why we have the typesystems right |
| 2021-07-25 13:34:09 | <[exa]> | you can always ask the compiler for the most general type using the hole, as `myfunc :: _` |
| 2021-07-25 13:34:32 | <Hecate> | arkanoid: it is not, and you will gain in runtime perf with monomorphic functions |
| 2021-07-25 13:34:58 | <[exa]> | (generally, "prototype then polish" is wildly underestimated rule for good programming) |
| 2021-07-25 13:36:12 | <arkanoid> | good :) thanks. [exa] what do you mean by "ask the compiler for the most general type using the hole"? |
| 2021-07-25 13:36:29 | → | curiousgay joins (~curiousga@77-120-186-48.kha.volia.net) |
| 2021-07-25 13:36:39 | → | tremon joins (~tremon@217-63-61-89.cable.dynamic.v4.ziggo.nl) |
| 2021-07-25 13:37:25 | → | burnsidesLlama joins (~burnsides@client-8-87.eduroam.oxuni.org.uk) |
| 2021-07-25 13:38:55 | <Hecate> | arkanoid: if you literally write a type signature "foo :: _", GHC will try to fill the hole (the underscore) with what it thinks is the best type |
| 2021-07-25 13:39:41 | <[exa]> | let's try |
| 2021-07-25 13:39:57 | <[exa]> | % "asd" + [_] |
| 2021-07-25 13:40:03 | <yahb> | [exa]: [Timed out] |
| 2021-07-25 13:40:12 | <[exa]> | oh noes |
| 2021-07-25 13:40:59 | <[exa]> | (I forgot a +, let's retry with lambdabot) |
| 2021-07-25 13:41:04 | <[exa]> | > "asd" ++ [ _ ] |
| 2021-07-25 13:41:08 | <lambdabot> | error: |
| 2021-07-25 13:41:08 | <lambdabot> | • Found hole: _ :: Char |
| 2021-07-25 13:41:08 | <lambdabot> | • In the expression: _ |
| 2021-07-25 13:41:39 | <[exa]> | arkanoid: it tells you what type fits there ^. if you put _ instead of the whole function type signature, you'll get a type derived for free. |
| 2021-07-25 13:42:16 | × | burnsidesLlama quits (~burnsides@client-8-87.eduroam.oxuni.org.uk) (Ping timeout: 265 seconds) |
| 2021-07-25 13:42:53 | <arkanoid> | very interesting. Is it something that's used by programmers? |
| 2021-07-25 13:43:10 | <arkanoid> | I mean, whenever you get lost on the type of something, just compile with _ and read the result? |
| 2021-07-25 13:43:39 | <[exa]> | I do that all the time |
| 2021-07-25 13:44:08 | <arkanoid> | :D |
| 2021-07-25 13:44:32 | <[exa]> | like, people invested unbelievable amount of time to make the error messages good, so why not utilize that? |
| 2021-07-25 13:44:34 | × | jneira_ quits (~jneira_@28.red-80-28-169.staticip.rima-tde.net) (Ping timeout: 240 seconds) |
| 2021-07-25 13:45:03 | → | peterhil joins (~peterhil@mobile-access-5d6af6-209.dhcp.inet.fi) |
| 2021-07-25 13:45:09 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-07-25 13:45:31 | <arkanoid> | I wonder how many cool tricks are there that I'm missing |
| 2021-07-25 13:45:45 | × | wei2912 quits (~wei2912@112.199.250.21) (Quit: Lost terminal) |
| 2021-07-25 13:46:39 | <[exa]> | arkanoid: this is priceless: http://dev.stephendiehl.com/hask/tutorial.pdf |
| 2021-07-25 13:46:51 | <arkanoid> | :D |
| 2021-07-25 13:48:20 | × | mjs2600 quits (~mjs2600@c-24-91-3-49.hsd1.vt.comcast.net) (Ping timeout: 255 seconds) |
| 2021-07-25 13:48:26 | × | hendursa1 quits (~weechat@user/hendursaga) (Quit: hendursa1) |
| 2021-07-25 13:48:54 | → | hendursaga joins (~weechat@user/hendursaga) |
| 2021-07-25 13:49:01 | × | oso quits (~oso@2601:58c:c080:a950:f275:2530:b398:680b) (Ping timeout: 246 seconds) |
| 2021-07-25 13:50:30 | → | jumper149 joins (~jumper149@80.240.31.34) |
| 2021-07-25 13:53:29 | → | gehmehgeh joins (~user@user/gehmehgeh) |
| 2021-07-25 13:58:14 | → | lbseale joins (~lbseale@user/ep1ctetus) |
| 2021-07-25 14:02:44 | × | MQ-17J quits (~MQ-17J@d14-69-206-129.try.wideopenwest.com) (Read error: Connection reset by peer) |
| 2021-07-25 14:03:14 | × | ubert quits (~Thunderbi@91.141.47.26.wireless.dyn.drei.com) (Quit: ubert) |
| 2021-07-25 14:03:27 | → | MQ-17J joins (~MQ-17J@d14-69-206-129.try.wideopenwest.com) |
| 2021-07-25 14:03:32 | → | ubert joins (~Thunderbi@91.141.47.26.wireless.dyn.drei.com) |
| 2021-07-25 14:03:53 | <arkanoid> | I'm confused by type IO [Integer] and ([Integer], World) |
| 2021-07-25 14:04:06 | × | ubert quits (~Thunderbi@91.141.47.26.wireless.dyn.drei.com) (Client Quit) |
| 2021-07-25 14:04:22 | → | ubert joins (~Thunderbi@91.141.47.26.wireless.dyn.drei.com) |
| 2021-07-25 14:07:27 | × | geekosaur quits (~geekosaur@xmonad/geekosaur) (Remote host closed the connection) |
| 2021-07-25 14:07:50 | × | jmorris quits (uid433911@id-433911.stonehaven.irccloud.com) (Quit: Connection closed for inactivity) |
| 2021-07-25 14:08:22 | → | ph88 joins (~ph88@2a02:8109:9e00:7e5c:8db8:987d:36eb:f1a6) |
| 2021-07-25 14:10:19 | → | geekosaur joins (~geekosaur@xmonad/geekosaur) |
| 2021-07-25 14:10:44 | × | LukeHoersten quits (~LukeHoers@user/lukehoersten) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-07-25 14:13:27 | × | ph88 quits (~ph88@2a02:8109:9e00:7e5c:8db8:987d:36eb:f1a6) (Ping timeout: 276 seconds) |
| 2021-07-25 14:13:57 | <arkanoid> | if feels just like syntax sugar |
| 2021-07-25 14:14:36 | <geekosaur> | it is, sort of; it ensures you have a data dependency in the invocation and therefore things happen in the right order |
| 2021-07-25 14:15:20 | × | ubert quits (~Thunderbi@91.141.47.26.wireless.dyn.drei.com) (Ping timeout: 255 seconds) |
| 2021-07-25 14:15:21 | <geekosaur> | you could do it manually (although the actual type is a little more complicated) |
| 2021-07-25 14:16:44 | <geekosaur> | but it has nothing to do with IO other than ensuring that ordering |
All times are in UTC.