Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,803,623 events total
2021-07-26 19:23:48 <DigitalKiwi> very good
2021-07-26 19:23:52 DigitalKiwi gives monochrom a bot snack
2021-07-26 19:23:57 <monochrom> https://groups.google.com/g/comp.lang.functional/c/VhekkXaMXew/m/tZVh_fKWGlcJ
2021-07-26 19:24:01 <monochrom> :)
2021-07-26 19:24:42 × drd quits (~drd@93-39-151-19.ip76.fastwebnet.it) (Ping timeout: 240 seconds)
2021-07-26 19:25:28 <monochrom> in which I missed the opportunity to phrase it as "bug production and bugfix production".
2021-07-26 19:25:29 × eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2021-07-26 19:25:44 <DigitalKiwi> i came up with the punchline; the joke was supposed to be about parsers/compilers; but then i couldn't think of a good joke so i just let the reader infer one ;p
2021-07-26 19:26:06 eggplantade joins (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net)
2021-07-26 19:27:44 phma_ joins (phma@2001:5b0:211b:f028:d413:7a65:5bfd:d581)
2021-07-26 19:28:05 <Hecate> context inference, typical haskeller joke
2021-07-26 19:28:05 × phma quits (phma@2001:0:c38c:c38c:2470:b89:bcd3:2fcf) (Ping timeout: 255 seconds)
2021-07-26 19:28:47 × LukeHoersten quits (~LukeHoers@user/lukehoersten) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-07-26 19:29:36 <DigitalKiwi> :D
2021-07-26 19:30:04 <DigitalKiwi> that i was too lazy to create a proper joke too lol
2021-07-26 19:30:20 × eggplantade quits (~Eggplanta@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Ping timeout: 255 seconds)
2021-07-26 19:31:05 LukeHoersten joins (~LukeHoers@user/lukehoersten)
2021-07-26 19:32:15 <DigitalKiwi> https://mostlyabsurd.com/files/2021-07-26-193120_2215x569_scrot.png
2021-07-26 19:39:49 mcglk_ joins (~mcglk@131.191.49.120)
2021-07-26 19:40:01 cohn joins (~noone@user/cohn)
2021-07-26 19:41:02 × mcglk quits (~mcglk@131.191.49.120) (Ping timeout: 252 seconds)
2021-07-26 19:42:12 <mastarija> In very abstract terms, let's say I'm describing some action that can either produce success or failure, when using the Alternative, what should alternative do?
2021-07-26 19:42:36 <mastarija> My instinct is, if a1 in a1 <|> a2 fails, then it should return a1
2021-07-26 19:42:48 <mastarija> Otherwise it should return a2
2021-07-26 19:42:54 chris_ joins (~chris@81.96.113.213)
2021-07-26 19:42:56 <mastarija> But what if both of actions fail?
2021-07-26 19:43:07 <Rembane> It should produce failure imo
2021-07-26 19:43:09 <mastarija> Should I only return the second one, or concat them?
2021-07-26 19:43:32 <mastarija> Rembane, I forgot to mention, I'm looking to return the failure error at the end
2021-07-26 19:43:56 <mastarija> So I'm not sure if I should return both failure errors, or just the last one I've tested?
2021-07-26 19:44:03 <monochrom> a1 *> a2 already does "both need to succeed". What would be the point of <|> if it did the same thing.
2021-07-26 19:44:05 <Hecate> if you care so much about using (<|>) then write an Either-like type for which the Applicative law is reversed :P
2021-07-26 19:44:08 <mastarija> My intuition is "just" the last one
2021-07-26 19:44:22 × dunkeln quits (~dunkeln@94.129.69.87) (Ping timeout: 268 seconds)
2021-07-26 19:44:47 <dsal> > Nothing <|> Just 3
2021-07-26 19:44:48 <lambdabot> Just 3
2021-07-26 19:44:49 <dsal> > Nothing <|> Nothing
2021-07-26 19:44:51 <lambdabot> Nothing
2021-07-26 19:45:17 <mastarija> Error a <|> Error b = Error b
2021-07-26 19:45:19 <mastarija> Or
2021-07-26 19:45:25 <monochrom> And considering the law "empty <|> x = x".
2021-07-26 19:45:29 <mastarija> Error a <|> Error b = Error a <> b
2021-07-26 19:45:42 <geekosaur> isn't that These?
2021-07-26 19:46:02 <mastarija> geekosaur, what do you mean?
2021-07-26 19:46:13 <geekosaur> @hackage these
2021-07-26 19:46:13 <lambdabot> https://hackage.haskell.org/package/these
2021-07-26 19:46:29 <mastarija> Oh
2021-07-26 19:47:27 shapr joins (~user@pool-100-36-247-68.washdc.fios.verizon.net)
2021-07-26 19:48:06 <mastarija> geekosaur, no I need Monoid among other instances for my usecase
2021-07-26 19:48:46 <mastarija> But my question is more about the "Alternative" in general
2021-07-26 19:48:53 <mastarija> What is the reasoning behind it
2021-07-26 19:49:24 <mastarija> It says it's a monoid on applicative functors
2021-07-26 19:49:29 <Rembane> I think the very informal reasoning is: pick the first one that works.
2021-07-26 19:49:49 <mastarija> Yes, but what if neither work, but that "not working" produces a result
2021-07-26 19:49:55 <mastarija> Do I return both results
2021-07-26 19:50:00 <mastarija> Or just the last one?
2021-07-26 19:50:31 <mastarija> I have constraint that my type is "Monoid a => MyType a"
2021-07-26 19:51:01 <mastarija> Rembane, In that case I could mappend the two wrong results
2021-07-26 19:51:10 <Rembane> mastarija: If nothing works, you could return mempty.
2021-07-26 19:51:16 × wz1000_ quits (~zubin@static.11.113.47.78.clients.your-server.de) (Quit: WeeChat 2.8)
2021-07-26 19:51:25 wz1000 joins (~zubin@static.11.113.47.78.clients.your-server.de)
2021-07-26 19:51:44 <Rembane> mastarija: What I forgot to say earlier is that you decide this. It's your type. What makes sense to you? You can look at Maybe, Either and These for inspiration.
2021-07-26 19:51:45 <mastarija> Rembane, but I want to return information about what didn't work
2021-07-26 19:51:58 <mastarija> Rembane, ok
2021-07-26 19:52:06 <mastarija> That's the answer I was looking for
2021-07-26 19:52:09 <mastarija> :D
2021-07-26 19:52:33 <Rembane> :D
2021-07-26 19:52:45 × justsomeguy quits (~justsomeg@user/justsomeguy) (Quit: WeeChat 3.2)
2021-07-26 19:53:02 <dsal> I've tried some validation class that was like an error collecting Either, but it was more complicated and a worse experience than just not running a separate validation phase (from my parser).
2021-07-26 19:53:04 × Null_A quits (~null_a@2601:645:8700:2290:98e5:42b9:7e41:db99) (Remote host closed the connection)
2021-07-26 19:53:32 <Rembane> Another example is a result type for a web form, there you probably want to have a way to collect the errors and associate them with fields.
2021-07-26 19:53:46 Null_A joins (~null_a@2601:645:8700:2290:98e5:42b9:7e41:db99)
2021-07-26 19:54:27 <mastarija> https://hackage.haskell.org/package/valor
2021-07-26 19:54:32 <mastarija> Rembane, my library
2021-07-26 19:54:45 <mastarija> I'm just working on some improvements and simplifications
2021-07-26 19:55:17 kayprish joins (~kayprish@cable-188-2-229-172.dynamic.sbb.rs)
2021-07-26 19:55:22 <dsal> ` <*> checks username [nonempty, nonbollocks, nonshort]`
2021-07-26 19:55:34 <mastarija> :D
2021-07-26 19:55:53 <Rembane> mastarija: Cool!
2021-07-26 19:56:02 <mastarija> I'm adding alternative, and monad interface right now
2021-07-26 19:56:31 <mastarija> + some overloaded check to replace all that checks mapChecks check etc.. functions
2021-07-26 19:57:40 <dsal> mastarija: Have you looked at this one? https://hackage.haskell.org/package/validation
2021-07-26 19:57:49 <dsal> That's the one I used briefly and then stopped using
2021-07-26 19:58:49 <mastarija> Yes, I've checked out a few of them, but they were too annoying to use
2021-07-26 19:59:00 <mastarija> So I've made something to fit my tastes
2021-07-26 19:59:03 <dsal> Good, good.
2021-07-26 19:59:21 × LukeHoersten quits (~LukeHoers@user/lukehoersten) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-07-26 19:59:27 <mastarija> I was more into "structured" validation, and working with records.
2021-07-26 20:00:32 mcglk joins (~mcglk@131.191.49.120)
2021-07-26 20:02:02 × Null_A quits (~null_a@2601:645:8700:2290:98e5:42b9:7e41:db99) (Remote host closed the connection)
2021-07-26 20:02:16 Null_A joins (~null_a@2601:645:8700:2290:98e5:42b9:7e41:db99)
2021-07-26 20:02:30 × mcglk_ quits (~mcglk@131.191.49.120) (Ping timeout: 256 seconds)
2021-07-26 20:05:24 × juhp quits (~juhp@128.106.188.220) (Ping timeout: 265 seconds)
2021-07-26 20:06:28 × neceve quits (~quassel@2a02:c7f:607e:d600:f762:20dd:304e:4b1f) (Ping timeout: 256 seconds)
2021-07-26 20:06:39 × deejaytee quits (~deejaytee@cpc91196-cmbg18-2-0-cust215.5-4.cable.virginm.net) (Quit: Leaving)
2021-07-26 20:06:42 blackfield parts (~blackfiel@85.255.4.218) ()
2021-07-26 20:06:44 juhp joins (~juhp@128.106.188.220)
2021-07-26 20:07:32 drd joins (~drd@2001:b07:a70:9f1f:1562:34de:f50f:77d4)
2021-07-26 20:08:14 × roboguy_ quits (~roboguy_@2605:a601:ac0e:ae00:f433:8617:e8c3:dcbe) (Remote host closed the connection)
2021-07-26 20:08:46 roboguy_ joins (~roboguy_@2605:a601:ac0e:ae00:f433:8617:e8c3:dcbe)

All times are in UTC.