Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Utils for Monads
Synopsis
- class MonadIO m => MonadInIO m where
- module Control.Monad
- module Control.Monad.IO.Class
- module Control.Monad.Trans.Class
- whileM :: Monad m => m Bool -> m ()
- loop :: (a -> Either a b) -> a -> b
- loopM :: Monad m => (a -> m (Either a b)) -> a -> m b
- whenM :: Monad m => m Bool -> m () -> m ()
- unlessM :: Monad m => m Bool -> m () -> m ()
- ifM :: Monad m => m Bool -> m a -> m a -> m a
- notM :: Functor m => m Bool -> m Bool
- anyM :: Monad m => (a -> m Bool) -> [a] -> m Bool
- allM :: Monad m => (a -> m Bool) -> [a] -> m Bool
- orM :: Monad m => [m Bool] -> m Bool
- andM :: Monad m => [m Bool] -> m Bool
Documentation
class MonadIO m => MonadInIO m where Source #
liftWith :: (forall c. (a -> IO c) -> IO c) -> (a -> m b) -> m b Source #
Lift with*-like functions into IO (alloca, etc.)
liftWith2 :: (forall c. (a -> b -> IO c) -> IO c) -> (a -> b -> m e) -> m e Source #
Lift with*-like functions into IO (alloca, etc.)
module Control.Monad
module Control.Monad.IO.Class
module Control.Monad.Trans.Class
unlessM :: Monad m => m Bool -> m () -> m () Source #
Like unless
, but where the test can be monadic.
anyM :: Monad m => (a -> m Bool) -> [a] -> m Bool Source #
A version of any
lifted to a monad. Retains the short-circuiting behaviour.
anyM Just [False,True ,undefined] == Just True anyM Just [False,False,undefined] == undefined \(f :: Int -> Maybe Bool) xs -> anyM f xs == orM (map f xs)
allM :: Monad m => (a -> m Bool) -> [a] -> m Bool Source #
A version of all
lifted to a monad. Retains the short-circuiting behaviour.
allM Just [True,False,undefined] == Just False allM Just [True,True ,undefined] == undefined \(f :: Int -> Maybe Bool) xs -> anyM f xs == orM (map f xs)