Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Monad reexports from extra
and some combinators
Synopsis
- tap :: Functor m => (a -> m ()) -> a -> m a
- firstJustM :: Monad m => (a -> m (Maybe b)) -> [a] -> m (Maybe b)
- findM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a)
- untilJustM :: Monad m => m (Maybe a) -> m a
- whileJustM :: (Monad m, Monoid a) => m (Maybe a) -> m a
- whileM :: Monad m => m Bool -> m ()
- whenMaybeM :: Monad m => m Bool -> m a -> m (Maybe a)
- whenMaybe :: Applicative m => Bool -> m a -> m (Maybe a)
- pureIf :: Alternative m => Bool -> a -> m a
- whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m ()
- whenJust :: Applicative m => Maybe a -> (a -> m ()) -> m ()
Documentation
tap :: Functor m => (a -> m ()) -> a -> m a Source #
Call a side-effecting function on a value and return the value.
firstJustM :: Monad m => (a -> m (Maybe b)) -> [a] -> m (Maybe b) #
Like findM
, but also allows you to compute some additional information in the predicate.
findM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a) #
Like find
, but where the test can be monadic.
findM (Just . isUpper) "teST" == Just (Just 'S') findM (Just . isUpper) "test" == Just Nothing findM (Just . const True) ["x",undefined] == Just (Just "x")
untilJustM :: Monad m => m (Maybe a) -> m a #
whileJustM :: (Monad m, Monoid a) => m (Maybe a) -> m a #
whenMaybeM :: Monad m => m Bool -> m a -> m (Maybe a) #
Like whenMaybe
, but where the test can be monadic.
whenMaybe :: Applicative m => Bool -> m a -> m (Maybe a) #
pureIf :: Alternative m => Bool -> a -> m a #