3 ms·
The thing you're looking for is easily found with a Hoogle search for type (a -> Maybe b) -> [a] -> [b] Which yields mapMaybe: https://hackage.haskell.org
by _v7gu 4y ago
The thing you're looking for is easily found with a Hoogle search for type
(a -> Maybe b) -> [a] -> [b]
Which yields mapMaybe: https://hackage.haskell.org/package/base-4.17.0.0/docs/Data-Maybe.html#v:mapMaybe https://hackage.haskell.org/package/base-4.17.0.0/docs/Data-.... so you end up with
heads = mapMaybe safeHead
- ogogmad 4y agoThat doesn't look like a direct substitute that covers every case.