Some additional operations on monads.
concatMapM
:: Monad b => (a -> b [c]) -> [a] -> b [c]
Same as concatMap, but for a monadic function.
mapAccumM
:: Monad c => (a -> b -> c (a, d)) -> a -> [b] -> c (a, [d])
Same as mapM
but with an additional accumulator threaded through.
unlessM
:: Monad a => a Bool -> a () -> a ()
Monadic version of unless
where the condition is defined by a
monadic operation.
whenM
:: Monad a => a Bool -> a () -> a ()
Monadic version of when
where the condition is defined by a
monadic operation.
ifM
:: Monad a => a Bool -> a b -> a b -> a b
Monadic version of if
where the condition is defined by a
monadic operation.