postgresql-simple icon indicating copy to clipboard operation
postgresql-simple copied to clipboard

Applicative instance for Only

Open robinp opened this issue 7 years ago • 2 comments

This would be useful to do fmap join . sequenceA . listToMaybe on a query which normally returns [Only (Maybe a)]. With the magic sequence this becomes Only (Maybe a).

robinp avatar Dec 05 '18 18:12 robinp

Or, to golf more, join . fromOnly . sequenceA . listToMaybe to get Maybe a.

robinp avatar Dec 05 '18 19:12 robinp

Only is defined in http://hackage.haskell.org/package/Only package

phadej avatar Jan 30 '19 09:01 phadej