filterM
:: Applicative a => (b -> a Bool) -> [b] -> a [b] This generalizes the list-based filter function. |
(>=>)
:: Monad a => (b -> a c) -> (c -> a d) -> b -> a d Left-to-right composition of Kleisli arrows. |
(<=<)
:: Monad a => (b -> a c) -> (d -> a b) -> d -> a c Right-to-left composition of Kleisli arrows. |
forever
:: Applicative a => a b -> a c Repeat an action indefinitely. |
mapAndUnzipM
:: Applicative a => (b -> a (c,d)) -> [b] -> a ([c],[d]) The mapAndUnzipM function maps its first argument over a list, returning the result as a pair of lists. |
zipWithM
:: Applicative a => (b -> c -> a d) -> [b] -> [c] -> a [d] The zipWithM function generalizes zipWith to arbitrary applicative functors. |
zipWithM_
:: Applicative a => (b -> c -> a d) -> [b] -> [c] -> a () zipWithM_ is the extension of zipWithM which ignores the final result. |
foldM
:: Monad a => (b -> c -> a b) -> b -> [c] -> a b The foldM function is analogous to foldl, except that its result is encapsulated in a monad. |
foldM_
:: Monad a => (b -> c -> a b) -> b -> [c] -> a () Like foldM, but discards the result. |
replicateM
:: Applicative a => Int -> a b -> a [b] |
replicateM_
:: Applicative a => Int -> a b -> a () Like replicateM, but discards the result. |
unless
:: Applicative a => Bool -> a () -> a () The reverse of when. |
liftM3
:: Monad a => (b -> c -> d -> e) -> a b -> a c -> a d -> a e Promotes a ternary function to a monad. |
join
:: Monad a => a (a b) -> a b Removes one level of monadic structure, i.e. |
void
:: Functor a => a b -> a () Ignores the result of the evaluation. |
forM
:: Monad a => [b] -> (b -> a c) -> a [c] forM
is mapM
with its arguments flipped.
|
forM_
:: Monad a => [b] -> (b -> a c) -> a () forM_
is mapM_
with its arguments flipped.
|
This generalizes the list-based filter function. |
Left-to-right composition of Kleisli arrows.
|
Right-to-left composition of Kleisli arrows. @(>=>)@, with the arguments flipped.
|
Repeat an action indefinitely. |
The mapAndUnzipM function maps its first argument over a list, returning the result as a pair of lists. This function is mainly used with complicated data structures or a state-transforming monad. |
The zipWithM function generalizes zipWith to arbitrary applicative functors. |
zipWithM_ is the extension of zipWithM which ignores the final result. |
The foldM function is analogous to foldl, except that its result is encapsulated in a monad. |
|
Like replicateM, but discards the result. |
Promotes a ternary function to a monad. The function arguments are scanned from left to right. Examples: > liftM3 (\x y z -> x+y+z) [1,2] [3,4] [5,6] [9,10,10,11,10,11,11,12] > liftM3 (,,) [1,2] [3,4] [5,6] [(1,3,5),(1,3,6),(1,4,5),(1,4,6),(2,3,5),(2,3,6),(2,4,5),(2,4,6)] |
Ignores the result of the evaluation. |
|
main = forM_ [1, 2, 3] $ \i -> print i |