Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,642 events total
2021-07-27 12:06:40 <Arahael> (Right? That `fromMaybe` isn't preserving the input, isn't it?)
2021-07-27 12:06:41 × lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection)
2021-07-27 12:06:47 <jippiedoe> What do you mean with 'it replaces the value in either case'?
2021-07-27 12:06:58 <Arahael> jippiedoe: What does it do if aValue is Nothing?
2021-07-27 12:07:23 <jippiedoe> fromMaybe d x = case x of {Nothing -> d;Just v -> v}
2021-07-27 12:07:47 <jippiedoe> fromMaybe a Nothing = a
2021-07-27 12:08:07 anandprabhu joins (~anandprab@94.202.243.198)
2021-07-27 12:09:19 <Arahael> Oh, yeah. I was confused.
2021-07-27 12:09:30 <Arahael> Thanks - the user-provided function provides the original value.
2021-07-27 12:10:02 <Arahael> Hmm, which means it becomes explicitly set?
2021-07-27 12:10:36 Arahael thinks it doesn't make a difference - the lens don't distinguish, he thinks.
2021-07-27 12:10:59 eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-07-27 12:12:00 × fossdd quits (~fossdd@sourcehut/user/fossdd) (Ping timeout: 250 seconds)
2021-07-27 12:13:05 fossdd joins (~fossdd@sourcehut/user/fossdd)
2021-07-27 12:13:27 × anandprabhu quits (~anandprab@94.202.243.198) (Ping timeout: 245 seconds)
2021-07-27 12:15:33 × eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 258 seconds)
2021-07-27 12:19:47 lavaman joins (~lavaman@98.38.249.169)
2021-07-27 12:23:46 × raehik1 quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Ping timeout: 240 seconds)
2021-07-27 12:25:01 raehik1 joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2021-07-27 12:26:32 × raehik1 quits (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net) (Client Quit)
2021-07-27 12:29:35 raehik joins (~raehik@cpc95906-rdng25-2-0-cust156.15-3.cable.virginm.net)
2021-07-27 12:32:33 × lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection)
2021-07-27 12:32:50 lavaman joins (~lavaman@98.38.249.169)
2021-07-27 12:32:58 × lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection)
2021-07-27 12:33:35 lavaman joins (~lavaman@98.38.249.169)
2021-07-27 12:33:43 × lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection)
2021-07-27 12:34:39 lavaman joins (~lavaman@98.38.249.169)
2021-07-27 12:39:42 × arjun quits (~Srain@user/arjun) (Ping timeout: 258 seconds)
2021-07-27 12:41:11 × lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 252 seconds)
2021-07-27 12:41:43 <tomsmeding> Arahael: what about `aVar & aField %~ (aValue <|>)`
2021-07-27 12:42:03 <tomsmeding> disclaimer: I have no idea about lenses, but with regards to Maybe, that should have the semantics that you describe I think?
2021-07-27 12:42:24 <tomsmeding> ( (<|>) from Alternative in Control.Applicative)
2021-07-27 12:42:35 <Arahael> tomsmeding: That's a variant of what jippiedoe suggested, I think. That works also, I think.
2021-07-27 12:42:47 <Arahael> So I have three options now. :D And I've now learnt about %~
2021-07-27 12:43:06 × fossdd quits (~fossdd@sourcehut/user/fossdd) (Ping timeout: 268 seconds)
2021-07-27 12:43:45 fossdd joins (~fossdd@sourcehut/user/fossdd)
2021-07-27 12:43:54 × texasmynsted_ quits (~texasmyns@99.96.221.112) (Ping timeout: 240 seconds)
2021-07-27 12:45:08 gzj joins (~GZJ0X@199.193.127.138.16clouds.com)
2021-07-27 12:45:11 <tomsmeding> oh wait 'aField' is not a Maybe but just the value itself? Then yes, fromMaybe :p
2021-07-27 12:45:28 hendursaga joins (~weechat@user/hendursaga)
2021-07-27 12:45:47 <jippiedoe> Ah, I interpreted the field to be of type `a` that you want to replace if the replacement exists, whereas tomsmeding's suggestion works if the field is of type `Maybe a`
2021-07-27 12:45:54 <tomsmeding> ^
2021-07-27 12:46:10 <jippiedoe> and while I was typing I didn't see you saw it too already :)
2021-07-27 12:46:23 tomsmeding high-5's jippiedoe
2021-07-27 12:48:16 <Arahael> Ah, interesting.
2021-07-27 12:53:18 eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-07-27 12:55:05 × azeem quits (~azeem@62.18.161.85) (Ping timeout: 265 seconds)
2021-07-27 12:55:17 jolly joins (~jolly@208.180.97.158)
2021-07-27 12:57:59 × eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 265 seconds)
2021-07-27 12:58:19 azeem joins (~azeem@62.18.161.85)
2021-07-27 12:58:34 × jneira quits (~jneira@212.8.115.226) (Quit: Client closed)
2021-07-27 13:00:24 × dunkeln quits (~dunkeln@94.129.69.87) (Ping timeout: 265 seconds)
2021-07-27 13:00:25 argento joins (~argent0@168-227-96-51.ptr.westnet.com.ar)
2021-07-27 13:01:06 alx741 joins (~alx741@186.178.108.3)
2021-07-27 13:02:14 × chris_ quits (~chris@81.96.113.213) (Remote host closed the connection)
2021-07-27 13:02:39 <xerox> :t fmap . const
2021-07-27 13:02:41 <lambdabot> Functor f => b -> f a -> f b
2021-07-27 13:02:49 <xerox> I'd do it like that
2021-07-27 13:03:14 chris_ joins (~chris@81.96.113.213)
2021-07-27 13:03:28 <Taneb> :t (<$)
2021-07-27 13:03:30 <lambdabot> Functor f => a -> f b -> f a
2021-07-27 13:04:30 lavaman joins (~lavaman@98.38.249.169)
2021-07-27 13:04:37 × lavaman quits (~lavaman@98.38.249.169) (Remote host closed the connection)
2021-07-27 13:06:14 × gzj quits (~GZJ0X@199.193.127.138.16clouds.com) (Remote host closed the connection)
2021-07-27 13:06:32 gzj joins (~GZJ0X@199.193.127.138.16clouds.com)
2021-07-27 13:07:12 × gzj quits (~GZJ0X@199.193.127.138.16clouds.com) (Remote host closed the connection)
2021-07-27 13:07:32 gzj joins (~GZJ0X@199.193.127.138.16clouds.com)
2021-07-27 13:08:12 × gzj quits (~GZJ0X@199.193.127.138.16clouds.com) (Read error: Connection reset by peer)
2021-07-27 13:08:30 gzj joins (~GZJ0X@199.193.127.138.16clouds.com)
2021-07-27 13:09:11 × gzj quits (~GZJ0X@199.193.127.138.16clouds.com) (Remote host closed the connection)
2021-07-27 13:09:31 gzj joins (~GZJ0X@199.193.127.138.16clouds.com)
2021-07-27 13:11:13 × gzj quits (~GZJ0X@199.193.127.138.16clouds.com) (Remote host closed the connection)
2021-07-27 13:12:22 Morgan joins (~Morgan@host81-152-76-173.range81-152.btcentralplus.com)
2021-07-27 13:13:15 × Morgan quits (~Morgan@host81-152-76-173.range81-152.btcentralplus.com) (Client Quit)
2021-07-27 13:13:49 eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-07-27 13:13:49 × wei2912 quits (~wei2912@112.199.250.21) (Quit: Lost terminal)
2021-07-27 13:16:48 × adanwan_ quits (~adanwan@gateway/tor-sasl/adanwan) (Remote host closed the connection)
2021-07-27 13:17:02 adanwan joins (~adanwan@gateway/tor-sasl/adanwan)
2021-07-27 13:17:54 × eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 240 seconds)
2021-07-27 13:18:21 × jippiedoe quits (~david@2a02-a44c-e14e-1-bf41-1b3a-cc17-853c.fixed6.kpn.net) (Ping timeout: 276 seconds)
2021-07-27 13:18:46 <arkanoid> where I can find good examples of simple haskell programs that can show me a picture of IO, error handling and Monads in general? I keep finding snippets of different topics, but not real programs
2021-07-27 13:19:27 Morgan joins (~Morgan@host81-152-76-173.range81-152.btcentralplus.com)
2021-07-27 13:20:50 <merijn> shellcheck? pandoc?
2021-07-27 13:20:58 <merijn> xmonad, I suppose?
2021-07-27 13:22:20 <tomsmeding> not sure those count as "simple" :p
2021-07-27 13:23:12 × Morgan quits (~Morgan@host81-152-76-173.range81-152.btcentralplus.com) (Client Quit)
2021-07-27 13:25:30 <[exa]> arkanoid: we can write some for you, if you have a topic
2021-07-27 13:26:19 <[exa]> arkanoid: a deceiving problem in haskell is that "simple" usually means "oneliner" which people sometimes refuse to accept as a valid example program :D
2021-07-27 13:29:05 <arkanoid> shellcheck and xmonad "simple" :D for simple I mean classic example of small game like tic tac toe (with input and output). Just random guessing. I prefer a good example of haskell code (yet doing IO) than a specific task
2021-07-27 13:29:48 <merijn> tic-tac-toe sounds much harder than shellcheck, tbh
2021-07-27 13:30:43 <[exa]> arkanoid: for tic-tac-toe, check out Brick library (or maybe Gloss)
2021-07-27 13:30:57 jippiedoe joins (~david@77-171-152-62.fixed.kpn.net)
2021-07-27 13:31:03 <__monty__> Error handling isn't very common in Haskell fwiw. So you're not likely to find it in short examples. IME
2021-07-27 13:31:03 <[exa]> iirc Brick even has some simple game in demos, it might have been snake or something
2021-07-27 13:31:21 × burnsidesLlama quits (~burnsides@dhcp168-022.wadham.ox.ac.uk) (Remote host closed the connection)
2021-07-27 13:35:45 lavaman joins (~lavaman@98.38.249.169)
2021-07-27 13:37:37 justsomeguy joins (~justsomeg@user/justsomeguy)
2021-07-27 13:37:56 × azeem quits (~azeem@62.18.161.85) (Ping timeout: 252 seconds)
2021-07-27 13:38:19 azeem joins (~azeem@62.18.161.85)
2021-07-27 13:39:12 × yahb quits (xsbot@user/mniip/bot/yahb) (Ping timeout: 252 seconds)

All times are in UTC.