mongoDB-0.9.5: MongoDB driver

Control.Monad.Util

Description

Extra monad functions and instances

Synopsis

Documentation

class (MonadIO m, Applicative m, Functor m) => MonadIO' m Source

MonadIO with extra Applicative and Functor superclasses

Instances

loop :: (Functor m, Monad m) => m (Maybe a) -> m [a]Source

Repeatedy execute action, collecting results, until it returns Nothing

untilJust :: Monad m => (a -> m (Maybe b)) -> [a] -> m (Maybe b)Source

Apply action to elements one at a time until one returns Just. Return Nothing if all return Nothing.

untilSuccess :: (MonadError e m, Error e) => (a -> m b) -> [a] -> m bSource

Apply action to elements one at a time until one succeeds. Throw last error if all fail. Throw strMsg error if list is empty.

untilSuccess' :: MonadError e m => e -> (a -> m b) -> [a] -> m bSource

Apply action to elements one at a time until one succeeds. Throw last error if all fail. Throw given error if list is empty

mapError :: Functor m => (e' -> e) -> ErrorT e' m a -> ErrorT e m aSource

Convert error type thrown

whenJust :: Monad m => Maybe a -> (a -> m ()) -> m ()Source