What are some of your favorite “useful” Haskell oneliners? There are some really well-known elegant ones such as the lazy fibonacci sequence:
fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
But I don’t need that sequence often in my day job…
So one I particularly like is when you have a
Maybe a values.
Data.HashMap.Strict does not provide a
catMaybes to throw away the
Nothings, but you can use:
Which is a really cool example of how the
id function is useful!