Conversation
f03b182 to
716e1aa
Compare
959255a to
dc97993
Compare
|
Oh, this is pretty cool. I have a little prototype of something similar but wilder - I made x <- leftJoin ...
... xhas leftJoin ... >>= \case
Nothing -> _
Just x -> _ xand it Just Works. I'm a bit nervous of this though, because obviously it incurs some pretty significant SQL. Your suggestion here looks to be basically the same idea, but rather than doing it at the I'm not sure about the type class and the DSL, I think foo <- leftJoin ...
matchMaybe foo \case
Nothing -> bar
Just x -> baz xWhich looks perfectly reasonable to me. Something else I've been considering oddly just got published to the Arxiv, which is to use pattern synonyms. https://arxiv.org/abs/2108.13114 is the paper in question, but the idea is essentially to have: pattern Just_
pattern Nothing_and to have these transparently look at the tag. So there's a whole bunch of stuff here, all with merit. I dunno which to pick! |
Yeah, that's fair.
Interesting! The Reddit discussion prompted me to consider this but I haven't actually read the paper yet. |
This looks super useful. I'm not sure why we didn't come up with this before!
Any thoughts? (Particularly @ocharles and @duairc). The same would work for
EitherFields.