[Haskell-beginners] Alternative

Imants Cekusins imantc at gmail.com
Wed Dec 28 10:55:06 UTC 2016


discovered this handy snippet today (duh :):

>>> foldl (<|>) Nothing [Nothing, Just 1, Nothing, Just 2]
Just 1

basically, pick first Just from a list of Maybes


http://hackage.haskell.org/package/base-4.9.0.0/docs/Control-Applicative.html#g:2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20161228/0b8f62ce/attachment.html>


More information about the Beginners mailing list