Logs: liberachat/#haskell
| 2021-07-27 16:45:10 | × | deejaytee quits (~deejaytee@193.46-255-62.static.virginmediabusiness.co.uk) (Killed (zirconium.libera.chat (Nickname regained by services))) |
| 2021-07-27 16:45:14 | → | deejaytee joins (~deejaytee@cpc91196-cmbg18-2-0-cust215.5-4.cable.virginm.net) |
| 2021-07-27 16:46:05 | × | azeem quits (~azeem@5.168.230.43) (Ping timeout: 255 seconds) |
| 2021-07-27 16:46:06 | × | geekosaur quits (~geekosaur@xmonad/geekosaur) (Killed (NickServ (GHOST command used by allbery_b))) |
| 2021-07-27 16:46:06 | → | allbery_b joins (~geekosaur@xmonad/geekosaur) |
| 2021-07-27 16:46:09 | allbery_b | is now known as geekosaur |
| 2021-07-27 16:47:46 | → | azeem joins (~azeem@176.200.192.84) |
| 2021-07-27 16:50:32 | → | burnsidesLlama joins (~burnsides@dhcp168-022.wadham.ox.ac.uk) |
| 2021-07-27 16:51:26 | × | fossdd quits (~fossdd@sourcehut/user/fossdd) (Ping timeout: 265 seconds) |
| 2021-07-27 16:52:01 | → | fossdd joins (~fossdd@sourcehut/user/fossdd) |
| 2021-07-27 16:52:05 | × | azeem quits (~azeem@176.200.192.84) (Ping timeout: 252 seconds) |
| 2021-07-27 16:52:33 | → | doyougnu joins (~user@c-73-25-202-122.hsd1.or.comcast.net) |
| 2021-07-27 16:52:40 | → | azeem joins (~azeem@176.200.192.84) |
| 2021-07-27 16:54:03 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-07-27 16:54:40 | → | aerona joins (~aerona@2600:6c54:4600:f300:85b8:3678:dd3f:eeda) |
| 2021-07-27 16:54:42 | × | curiousgay quits (~curiousga@77-120-186-48.kha.volia.net) (Ping timeout: 268 seconds) |
| 2021-07-27 16:55:56 | × | burnsidesLlama quits (~burnsides@dhcp168-022.wadham.ox.ac.uk) (Ping timeout: 252 seconds) |
| 2021-07-27 16:55:59 | × | gehmehgeh quits (~user@user/gehmehgeh) (Quit: Leaving) |
| 2021-07-27 16:57:19 | → | zebrag joins (~chris@user/zebrag) |
| 2021-07-27 16:59:04 | → | Vajb joins (~Vajb@hag-jnsbng11-58c3a1-224.dhcp.inet.fi) |
| 2021-07-27 16:59:06 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds) |
| 2021-07-27 16:59:15 | × | pottsy quits (~pottsy@2400:4050:b560:3700:3495:fb9e:8fab:95bf) (Ping timeout: 245 seconds) |
| 2021-07-27 16:59:25 | → | gehmehgeh joins (~user@user/gehmehgeh) |
| 2021-07-27 17:01:50 | × | drd quits (~drd@2001:b07:a70:9f1f:1562:34de:f50f:77d4) (Ping timeout: 255 seconds) |
| 2021-07-27 17:02:52 | → | Hanicef joins (~gustaf@81-229-9-108-no92.tbcn.telia.com) |
| 2021-07-27 17:04:16 | → | drd joins (~drd@93-39-151-19.ip76.fastwebnet.it) |
| 2021-07-27 17:08:59 | → | LukeHoersten joins (~LukeHoers@user/lukehoersten) |
| 2021-07-27 17:12:15 | → | anandprabhu joins (~anandprab@94.202.243.198) |
| 2021-07-27 17:12:59 | × | azeem quits (~azeem@176.200.192.84) (Ping timeout: 252 seconds) |
| 2021-07-27 17:13:27 | × | anandprabhu quits (~anandprab@94.202.243.198) (Client Quit) |
| 2021-07-27 17:13:44 | → | azeem joins (~azeem@176.200.252.165) |
| 2021-07-27 17:15:33 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-07-27 17:16:17 | × | peterhil quits (~peterhil@mobile-access-b04815-181.dhcp.inet.fi) (Ping timeout: 252 seconds) |
| 2021-07-27 17:18:59 | → | peterhil joins (~peterhil@mobile-access-b04815-181.dhcp.inet.fi) |
| 2021-07-27 17:21:16 | → | rmoe joins (~rmoe@c-71-236-207-44.hsd1.wa.comcast.net) |
| 2021-07-27 17:22:24 | → | curiousgay joins (~curiousga@77-120-186-48.kha.volia.net) |
| 2021-07-27 17:24:31 | × | argento quits (~argent0@168-227-96-51.ptr.westnet.com.ar) (Ping timeout: 258 seconds) |
| 2021-07-27 17:26:11 | × | michalz quits (~michalz@185.246.204.58) (Remote host closed the connection) |
| 2021-07-27 17:26:36 | × | jiribenes quits (~jiribenes@rosa.jiribenes.com) (Ping timeout: 250 seconds) |
| 2021-07-27 17:27:03 | → | burnsidesLlama joins (~burnsides@dhcp168-022.wadham.ox.ac.uk) |
| 2021-07-27 17:28:09 | <lechner> | Hi, is there an elegant way to deal with several Maybe values in a row without increasing the indentation in the source code but while reporting errors properly (i.e no fromJust)? Thanks! |
| 2021-07-27 17:28:47 | <geekosaur> | use the Monad instance? |
| 2021-07-27 17:28:55 | <monochrom> | >>= |
| 2021-07-27 17:29:21 | <lechner> | i am so new. is there an example on the web? |
| 2021-07-27 17:31:25 | × | burnsidesLlama quits (~burnsides@dhcp168-022.wadham.ox.ac.uk) (Ping timeout: 258 seconds) |
| 2021-07-27 17:32:45 | → | agua joins (~agua@2804:14c:8793:8e2f:39e9:c5a8:c532:7498) |
| 2021-07-27 17:34:25 | → | dunkeln_ joins (~dunkeln@94.129.69.87) |
| 2021-07-27 17:35:55 | → | Core8816 joins (~agua@2804:18:4a:f76c:1:0:5e60:e39) |
| 2021-07-27 17:36:12 | × | azeem quits (~azeem@176.200.252.165) (Ping timeout: 256 seconds) |
| 2021-07-27 17:36:12 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 256 seconds) |
| 2021-07-27 17:36:22 | × | pesada quits (~agua@177.79.68.96) (Ping timeout: 245 seconds) |
| 2021-07-27 17:36:28 | → | azeem joins (~azeem@176.201.0.90) |
| 2021-07-27 17:36:56 | → | Gurkenglas joins (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de) |
| 2021-07-27 17:39:02 | × | eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection) |
| 2021-07-27 17:39:20 | <sm> | lechner: write a do block, where each line extracts the next Just value with <-. If any of those fail, the whole block evaluates to Nothing |
| 2021-07-27 17:39:22 | × | agua quits (~agua@2804:14c:8793:8e2f:39e9:c5a8:c532:7498) (Ping timeout: 240 seconds) |
| 2021-07-27 17:39:44 | × | LukeHoersten quits (~LukeHoers@user/lukehoersten) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-07-27 17:39:57 | × | dunkeln_ quits (~dunkeln@94.129.69.87) (Quit: leaving) |
| 2021-07-27 17:40:17 | <lechner> | That's longhand for this, right? "By definition, when the first argument to >>= is Nothing, it just returns Nothing while ignoring whatever function it is given." https://en.m.wikibooks.org/wiki/Haskell/Understanding_monads/Maybe |
| 2021-07-27 17:42:59 | <Cale> | do-notation is a shorthand syntax for a chain of uses of (>>=) |
| 2021-07-27 17:43:21 | <Cale> | @undo do { u <- x; v <- y; return (f u v) } |
| 2021-07-27 17:43:22 | <lambdabot> | x >>= \ u -> y >>= \ v -> return (f u v) |
| 2021-07-27 17:43:29 | × | chris_ quits (~chris@81.96.113.213) (Remote host closed the connection) |
| 2021-07-27 17:43:32 | → | argento joins (~argent0@168-227-96-51.ptr.westnet.com.ar) |
| 2021-07-27 17:43:56 | <lechner> | thanks! i am making baby steps |
| 2021-07-27 17:44:02 | <Cale> | and so in the case of Maybe, you're allowed to have x and y be Maybe values there |
| 2021-07-27 17:44:16 | <Cale> | and then u and v will be the contents of the Just constructor in the case that they're both Just |
| 2021-07-27 17:44:51 | <Cale> | So it's a good way to unpack a bunch of Maybes and produce Nothing if any of them happens to be Nothing |
| 2021-07-27 17:45:46 | <Cale> | (the do-block as a whole will be a Maybe value in the case that x and y are) |
| 2021-07-27 17:46:48 | → | chris_ joins (~chris@81.96.113.213) |
| 2021-07-27 17:47:14 | <Cale> | There are also a bunch of functions which work with any instance of Monad, that specialise to possibly-useful functions on Maybe |
| 2021-07-27 17:47:17 | <Cale> | :t sequence |
| 2021-07-27 17:47:18 | <lambdabot> | (Traversable t, Monad m) => t (m a) -> m (t a) |
| 2021-07-27 17:47:36 | <Cale> | (That one is even more general now...) |
| 2021-07-27 17:47:51 | <Cale> | Well, if you just think of it as (Monad m) => [m a] -> m [a] |
| 2021-07-27 17:47:55 | <Cale> | for Maybe, that becomes |
| 2021-07-27 17:48:01 | <Cale> | [Maybe a] -> Maybe [a] |
| 2021-07-27 17:48:20 | <lechner> | thanks! my code is slowly gaining style. haskell is amazing. i already found several potential bugs in my Perl code, which i am translating |
| 2021-07-27 17:48:40 | × | peterhil quits (~peterhil@mobile-access-b04815-181.dhcp.inet.fi) (Ping timeout: 256 seconds) |
| 2021-07-27 17:48:46 | <Cale> | i.e. take a list of Maybe things, and see if they're all Just, if so, then you get Just of a list of the contents, if any was Nothing, you get Nothing |
| 2021-07-27 17:49:05 | <DigitalKiwi> | monochrom: https://twitter.com/krisajenkins/status/1420022268177027090?s=20 |
| 2021-07-27 17:50:02 | <lechner> | Cale: thanks! |
| 2021-07-27 17:51:36 | × | Hanicef quits (~gustaf@81-229-9-108-no92.tbcn.telia.com) (Quit: leaving) |
| 2021-07-27 17:51:59 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-07-27 17:52:45 | <Cale> | DigitalKiwi: I don't know how deterministic twitter's "More Tweets" section is, so https://twitter.com/d6/status/1419885183793344512 was pretty funny |
| 2021-07-27 17:52:53 | DigitalKiwi | takes them to clout court |
| 2021-07-27 17:54:40 | × | azeem quits (~azeem@176.201.0.90) (Read error: Connection reset by peer) |
| 2021-07-27 17:54:47 | × | fossdd quits (~fossdd@sourcehut/user/fossdd) (Ping timeout: 252 seconds) |
| 2021-07-27 17:55:21 | → | hnOsmium0001 joins (uid453710@id-453710.stonehaven.irccloud.com) |
| 2021-07-27 17:55:40 | → | fossdd joins (~fossdd@sourcehut/user/fossdd) |
| 2021-07-27 17:55:42 | <DigitalKiwi> | Cale: i follow d6 and this is the first time i've seen it lol |
| 2021-07-27 17:56:42 | × | wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 240 seconds) |
| 2021-07-27 17:56:48 | → | mr-red joins (~drd@2001:b07:a70:9f1f:1562:34de:f50f:77d4) |
| 2021-07-27 17:57:11 | → | azeem joins (~azeem@dynamic-adsl-94-34-48-122.clienti.tiscali.it) |
| 2021-07-27 17:57:21 | <lechner> | Hi, how can a function that returns a "Maybe (IO ()) perform an IO task, please? |
| 2021-07-27 17:57:32 | → | LukeHoersten joins (~LukeHoers@user/lukehoersten) |
| 2021-07-27 17:57:42 | → | jiribenes joins (~jiribenes@rosa.jiribenes.com) |
| 2021-07-27 17:57:54 | <Cale> | So, it might give you an action you could run to perform some IO, and it might not |
| 2021-07-27 17:58:30 | × | drd quits (~drd@93-39-151-19.ip76.fastwebnet.it) (Ping timeout: 276 seconds) |
| 2021-07-27 17:58:32 | <Cale> | The most straightforward thing you should understand first is just to pattern match on it with case |
All times are in UTC.