mapMaybe package:io-streams

A version of map that discards elements mapMaybe f s passes all output from s through the function f and discards elements for which f s evaluates to Nothing. Example:
ghci> Streams.fromList [Just 1, None, Just 3] >>=
Streams.mapMaybe id >>=
Streams.toList
[1,3]
Since: 1.2.1.0
Contravariant counterpart to contramapMaybe. contramap f s passes all input to s through the function f. Discards all the elements for which f returns Nothing. Since: 1.2.1.0