Closed ibarrae closed 3 years ago
Yeah! The code would look like: selectFirst query = fmap listToMaybe $ select $ limit 1 >> query
or something similar, but that is totally doable.
Maybe worthwhile to do in the 3.5 switchover.
Great, thanks for the quick reply @parsonsmatt, I'll wait for 3.5
to be merged and probably will work on those changes :tada:
esqueleto
re-exports the function selectFirst frompersistent
at the moment, I was wondering if a new function with similar functionality could be introduced. I've seen scenarios in which we only want 1 result or nothing from different queries. Probably doing something similar to the following:Something I have in mind (that I'm not even sure it compiles) would be something like the following:
I wonder if that's possible in
esqueleto
, probably would require somelifting
though :disappointed_relieved:. I hope all of these makes sense and thanks for the great library!