map -package:base -is:exact -is:exact -package:text -package:containers -package:bytestring -package:vector package:io-streams

Maps a pure function over an InputStream. map f s passes all output from s through the function f. Satisfies the following laws:
Streams.map (g . f) === Streams.map f >=> Streams.map g
Streams.map id === Streams.makeInputStream . Streams.read
Maps an impure function over an InputStream. mapM f s passes all output from s through the IO action f. Satisfies the following laws:
Streams.mapM (f >=> g) === Streams.mapM f >=> Streams.mapM g
Streams.mapM return === Streams.makeInputStream . Streams.read
Maps a side effect over an InputStream. mapM_ f s produces a new input stream that passes all output from s through the side-effecting IO action f. Example:
ghci> Streams.fromList [1,2,3] >>=
Streams.mapM_ (putStrLn . show . (*2)) >>=
Streams.toList
2
4
6
[1,2,3]
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 map. contramap f s passes all input to s through the function f. Satisfies the following laws:
Streams.contramap (g . f) === Streams.contramap g >=> Streams.contramap f
Streams.contramap id === return
Contravariant counterpart to mapM. contramapM f s passes all input to s through the IO action f Satisfies the following laws:
Streams.contramapM (f >=> g) = Streams.contramapM g >=> Streams.contramapM f
Streams.contramapM return = return
Equivalent to mapM_ for output. contramapM f s passes all input to s through the side-effecting IO action f.
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