Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→
Page 1 .. 481 482 483 484 485 486 487 488 489 490 491 .. 18003
1,800,273 events total
2021-06-15 20:11:43 <dminuoso> Are you preferrind go the "extensible dynamically-typed hierarchies of exceptions" part?
2021-06-15 20:11:50 <dminuoso> Wow. the typos are unreal today.
2021-06-15 20:13:29 <janus> i dunno if i prefer it since i havn't used exceptions in haskell yet. but i guess it could be valuable to avoid having dumb down to Either String everywhere. sounds like dynamically typed exceptions could help with that
2021-06-15 20:15:11 <janus> if i am injecting a function that can fail into a codebase that i don't want to continually bump versions for, i have the option of making it Either String, but then it is "stringly-typed". if i had my application-specific exception that it was catching, i would could make ad-hoc new "subtypes" of that exception?
2021-06-15 20:15:18 × tromp quits (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
2021-06-15 20:15:33 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 272 seconds)
2021-06-15 20:16:21 <dminuoso> janus: So under the hood, exceptions can only propagate as SomeException. So every time you do throwIO it gets wrapped (upcast) inside SomeException. At the same time, `catch` must be able to downcast it, using `fromException :: Exception e => SomeException -> Maybe e `
2021-06-15 20:16:30 <dminuoso> janus: This is how `catch` is able to catch only specific exceptions.
2021-06-15 20:16:35 <dminuoso> So far so good?
2021-06-15 20:16:54 × eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:b9b1:9fc2:289f:a533) (Remote host closed the connection)
2021-06-15 20:17:27 <dminuoso> (so if catch tries to fromException it to the specified exception type, but the underlying type is a different one, it would produce Nothing and the exception is thrown again)
2021-06-15 20:17:32 × kayprish quits (~kayprish@46.240.143.86) (Quit: leaving)
2021-06-15 20:17:39 ixlun joins (~matthew@213.205.241.86)
2021-06-15 20:17:45 <janus> right, makes sense. sounds a bit like subtyping but maybe i shouldn't think that
2021-06-15 20:17:59 <dminuoso> You should!
2021-06-15 20:18:13 <dminuoso> Using this trick we can build entire subtyping hierarchies
2021-06-15 20:18:36 Lycurgus joins (~juan@cpe-45-46-140-49.buffalo.res.rr.com)
2021-06-15 20:18:50 <dminuoso> SomeException :> DbException :> (UniquenessViolation | NotNullViolation)
2021-06-15 20:19:27 <janus> that looks nice, but is that really code?
2021-06-15 20:19:30 <dminuoso> Allowing you to say `(catch action (\e :: DbException -> ... ))` and it would catch any DbException, including UniquenessViolation and NotNullViolation
2021-06-15 20:19:55 <dminuoso> No, it's slightly verbose to encode these exceptions - but you get the same semantics
2021-06-15 20:20:15 <dminuoso> https://simonmar.github.io/bib/papers/ext-exceptions.pdf
2021-06-15 20:20:21 <janus> oh ok, sounds like it's time to crack open TemplateHaskell :satanic_smiley:
2021-06-15 20:20:23 <dminuoso> Is the original paper that describes it, it's very readable :)
2021-06-15 20:20:33 kuribas joins (~user@ptr-25vy0i96zxjh07ehrri.18120a2.ip6.access.telenet.be)
2021-06-15 20:20:34 <dminuoso> Im not sure you can reasonably do this with TemplateHaskell
2021-06-15 20:21:08 <janus> i'll take a look at the paper, cool beans
2021-06-15 20:21:19 <dminuoso> All of this is driven by Typeable behind the scenes. :)
2021-06-15 20:21:29 × gawen quits (~gawen@user/gawen) (Quit: cya)
2021-06-15 20:21:40 <dminuoso> base even comes with exceptions structured this way, sadly not too many packages do the same
2021-06-15 20:21:48 gawen joins (~gawen@user/gawen)
2021-06-15 20:22:41 × adium quits (adium@user/adium) (Quit: Stable ZNC by ##bnc4you)
2021-06-15 20:22:52 <dminuoso> It'd be nice if package-foo had some FooException supertype, especially if they have stuff like `withFoo :: (Foo -> IO b) -> IO b` because without a FooException type, you can't reasonably differentiate between any exception that comes from their library and say an IOException from your own continuation
2021-06-15 20:23:09 × ent quits (entgod@kapsi.fi) (Ping timeout: 252 seconds)
2021-06-15 20:23:26 <dminuoso> At least outside the `withFoo` combinator, of course.
2021-06-15 20:23:42 ent joins (entgod@kapsi.fi)
2021-06-15 20:24:35 <kuribas> why doesn't "foo {bar = 20}" work, when bar is a duplicate, and the type of foo is known?
2021-06-15 20:26:03 <kuribas> and how do I disambiguate?
2021-06-15 20:26:42 × Erutuon quits (~Erutuon@user/erutuon) (Ping timeout: 240 seconds)
2021-06-15 20:26:57 fishfinger joins (~fishfinge@cpc68330-cdif16-2-0-cust557.5-1.cable.virginm.net)
2021-06-15 20:27:27 <dminuoso> kuribas: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/duplicate_record_fields.html
2021-06-15 20:27:51 <kuribas> ugh, even (foo :: Foo) {bar = 20} doesn't work...
2021-06-15 20:28:19 <dminuoso> And: https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/disambiguate_record_fields.html#disambiguate-fields
2021-06-15 20:28:48 Erutuon joins (~Erutuon@user/erutuon)
2021-06-15 20:29:59 <dminuoso> kuribas: And I guess you can use a qualified import and then specify the field with a qualifier?
2021-06-15 20:30:53 <kuribas> still doesn't work even with Disambiguate-Fields
2021-06-15 20:31:07 ddellaco_ joins (~ddellacos@86.106.121.100)
2021-06-15 20:31:20 × reumeth quits (~reumeth@user/reumeth) (Ping timeout: 272 seconds)
2021-06-15 20:31:20 <kuribas> and foo {bar = 20} :: Foo doesn't work either
2021-06-15 20:32:01 AgentM joins (~agentm@pool-162-83-130-212.nycmny.fios.verizon.net)
2021-06-15 20:32:42 × ddellacosta quits (~ddellacos@86.106.121.100) (Ping timeout: 240 seconds)
2021-06-15 20:32:58 <kuribas> dminuoso: I could, but I'd like to understand the problem, rather than work around.
2021-06-15 20:33:42 tromp joins (~textual@dhcp-077-249-230-040.chello.nl)
2021-06-15 20:34:11 Techcable_ is now known as Techcable
2021-06-15 20:35:44 Topsi1 joins (~Tobias@dyndsl-037-138-064-101.ewe-ip-backbone.de)
2021-06-15 20:36:38 <kuribas> ugh, ghc is just plain dumb
2021-06-15 20:36:43 Topsi2 joins (~Tobias@dyndsl-037-138-064-101.ewe-ip-backbone.de)
2021-06-15 20:36:51 × Aighearach quits (~paris@c-71-63-160-210.hsd1.or.comcast.net) (Ping timeout: 268 seconds)
2021-06-15 20:37:41 × _ht quits (~quassel@82-169-194-8.biz.kpn.net) (Remote host closed the connection)
2021-06-15 20:38:06 Topsi3 joins (~Tobias@dyndsl-037-138-064-101.ewe-ip-backbone.de)
2021-06-15 20:38:14 adium joins (adium@user/adium)
2021-06-15 20:38:34 × Topsi quits (~Tobias@dyndsl-037-138-064-101.ewe-ip-backbone.de) (Ping timeout: 268 seconds)
2021-06-15 20:39:37 Topsi joins (~Tobias@dyndsl-037-138-064-101.ewe-ip-backbone.de)
2021-06-15 20:40:00 <kuribas> Use an explicit type signature on the record expression, as in: h x = (x :: T) { foo = 3 }
2021-06-15 20:40:00 <kuribas>
2021-06-15 20:40:00 <kuribas>
2021-06-15 20:40:06 <kuribas> Tried that, it doesn't work
2021-06-15 20:40:18 × mikoto-chan quits (~mikoto-ch@ip-213-49-189-31.dsl.scarlet.be) (Ping timeout: 240 seconds)
2021-06-15 20:40:19 eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:b9b1:9fc2:289f:a533)
2021-06-15 20:40:25 × Topsi1 quits (~Tobias@dyndsl-037-138-064-101.ewe-ip-backbone.de) (Ping timeout: 268 seconds)
2021-06-15 20:41:08 <dminuoso> kuribas: Im guessing at the time it was too complicated to implement DisambiguateRecordFields in the type checker.
2021-06-15 20:41:25 <dminuoso> Or maybe there's some complicated interaction with other extensions?
2021-06-15 20:41:35 <kuribas> I am using RecordWildCards
2021-06-15 20:41:39 × Topsi2 quits (~Tobias@dyndsl-037-138-064-101.ewe-ip-backbone.de) (Ping timeout: 268 seconds)
2021-06-15 20:42:53 × Topsi3 quits (~Tobias@dyndsl-037-138-064-101.ewe-ip-backbone.de) (Ping timeout: 268 seconds)
2021-06-15 20:43:19 <kuribas> could be a bug in ghc
2021-06-15 20:44:41 <dolio> The help page doesn't say you're allowed to do what you're trying to do.
2021-06-15 20:44:57 <kuribas> dolio: update a record?
2021-06-15 20:45:05 <dminuoso> kuribas: https://gitlab.haskell.org/ghc/ghc/-/issues/18999
2021-06-15 20:45:20 <dminuoso> Adam and SPJ concur that this is a bug.
2021-06-15 20:45:32 <kuribas> dminuoso: ok, thanks
2021-06-15 20:45:33 v01d4lph4 joins (~v01d4lph4@user/v01d4lph4)
2021-06-15 20:45:36 <kuribas> I'll use genericLens then
2021-06-15 20:46:00 <dolio> It says that the extension only does something for updates if there is a non-field named the same as a field.
2021-06-15 20:46:20 × mengu quits (~mengu@c188-150-13-129.bredband.tele2.se) (Remote host closed the connection)
2021-06-15 20:46:30 × tromp quits (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…)
2021-06-15 20:46:48 mengu joins (~mengu@c188-150-13-129.bredband.tele2.se)
2021-06-15 20:48:33 <dminuoso> Oh hold on
2021-06-15 20:48:43 <dminuoso> kuribas: are both `bar` fields?
2021-06-15 20:48:49 ubert joins (~Thunderbi@p200300ecdf259d17307db39712e8f4a3.dip0.t-ipconnect.de)
2021-06-15 20:49:08 <kuribas> dminuoso: what do you mean?
2021-06-15 20:49:22 <dminuoso> Maybe I misunderstood
2021-06-15 20:49:30 <dminuoso> 22:24:35 kuribas | why doesn't "foo {bar = 20}" work, when bar is a duplicate, and the type of foo is known?
2021-06-15 20:49:39 × fishfinger quits (~fishfinge@cpc68330-cdif16-2-0-cust557.5-1.cable.virginm.net) (Quit: Bye!)
2021-06-15 20:49:44 <dminuoso> You say "duplicate". Are both instances of `bar` fields, or is one a non-field?
2021-06-15 20:49:52 <kuribas> there is N.bar, but it is qualified
2021-06-15 20:49:54 × v01d4lph4 quits (~v01d4lph4@user/v01d4lph4) (Ping timeout: 240 seconds)
2021-06-15 20:50:04 fishfinger joins (~fishfinge@cpc68330-cdif16-2-0-cust557.5-1.cable.virginm.net)
2021-06-15 20:50:06 <kuribas> the other ones are fields
2021-06-15 20:50:09 <dminuoso> dolio is right then

All times are in UTC.