| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Foundation.Monad
Synopsis
- class Monad m => MonadIO (m :: Type -> Type) where
- class Monad m => MonadFailure (m :: Type -> Type) where
- class Monad m => MonadThrow m where
- class MonadThrow m => MonadCatch m where
- class MonadCatch m => MonadBracket m where
- generalBracket :: m a -> (a -> b -> m ignored1) -> (a -> SomeException -> m ignored2) -> (a -> m b) -> m b
- class MonadTrans trans where
- newtype Identity a = Identity {
- runIdentity :: a
- replicateM :: Applicative m => CountOf a -> m a -> m [a]
Documentation
class Monad m => MonadIO (m :: Type -> Type) where #
Instances
| MonadIO IO | |
Defined in Control.Monad.IO.Class | |
| MonadIO m => MonadIO (ResourceT m) Source # | |
Defined in Foundation.Conduit.Internal | |
| (Functor m, MonadIO m) => MonadIO (StateT s m) Source # | |
Defined in Foundation.Monad.State | |
| MonadIO m => MonadIO (ReaderT r m) Source # | |
Defined in Foundation.Monad.Reader | |
| MonadIO m => MonadIO (ExceptT e m) Source # | |
Defined in Foundation.Monad.Except | |
| MonadIO m => MonadIO (Conduit i o m) Source # | |
Defined in Foundation.Conduit.Internal | |
class Monad m => MonadFailure (m :: Type -> Type) where #
Instances
| MonadFailure Maybe | |
| MonadFailure (Either a) | |
| (Functor m, MonadFailure m) => MonadFailure (StateT s m) Source # | |
| MonadFailure m => MonadFailure (ReaderT r m) Source # | |
| Monad m => MonadFailure (ExceptT e m) Source # | |
| MonadFailure m => MonadFailure (Conduit i o m) Source # | |
| Monad state => MonadFailure (Builder collection mutCollection step state err) | |
class Monad m => MonadThrow m where Source #
Monad that can throw exception
Methods
throw :: Exception e => e -> m a Source #
Throw immediatity an exception.
Only a MonadCatch monad will be able to catch the exception using catch
Instances
| MonadThrow IO Source # | |
| MonadThrow m => MonadThrow (ResourceT m) Source # | |
| (Functor m, MonadThrow m) => MonadThrow (StateT s m) Source # | |
| MonadThrow m => MonadThrow (ReaderT r m) Source # | |
| MonadThrow m => MonadThrow (Conduit i o m) Source # | |
class MonadThrow m => MonadCatch m where Source #
Monad that can catch exception
Instances
| MonadCatch IO Source # | |
| MonadCatch m => MonadCatch (ResourceT m) Source # | |
| (Functor m, MonadCatch m) => MonadCatch (StateT s m) Source # | |
| MonadCatch m => MonadCatch (ReaderT r m) Source # | |
| MonadCatch m => MonadCatch (Conduit i o m) Source # | |
class MonadCatch m => MonadBracket m where Source #
Monad that can ensure cleanup actions are performed even in the case of exceptions, both synchronous and asynchronous. This usually excludes continuation-based monads.
Methods
Arguments
| :: m a | acquire some resource |
| -> (a -> b -> m ignored1) | cleanup, no exception thrown |
| -> (a -> SomeException -> m ignored2) | cleanup, some exception thrown. The exception will be rethrown |
| -> (a -> m b) | inner action to perform with the resource |
| -> m b |
A generalized version of the standard bracket function which allows distinguishing different exit cases.
Instances
| MonadBracket IO Source # | |
Defined in Foundation.Monad.Exception Methods generalBracket :: IO a -> (a -> b -> IO ignored1) -> (a -> SomeException -> IO ignored2) -> (a -> IO b) -> IO b Source # | |
| MonadBracket m => MonadBracket (ResourceT m) Source # | |
Defined in Foundation.Conduit.Internal Methods generalBracket :: ResourceT m a -> (a -> b -> ResourceT m ignored1) -> (a -> SomeException -> ResourceT m ignored2) -> (a -> ResourceT m b) -> ResourceT m b Source # | |
| MonadBracket m => MonadBracket (ReaderT r m) Source # | |
Defined in Foundation.Monad.Reader Methods generalBracket :: ReaderT r m a -> (a -> b -> ReaderT r m ignored1) -> (a -> SomeException -> ReaderT r m ignored2) -> (a -> ReaderT r m b) -> ReaderT r m b Source # | |
class MonadTrans trans where Source #
Basic Transformer class
Methods
lift :: Monad m => m a -> trans m a Source #
Lift a computation from an inner monad to the current transformer monad
Instances
| MonadTrans ResourceT Source # | |
| MonadTrans (StateT s) Source # | |
| MonadTrans (ReaderT r) Source # | |
| MonadTrans (ExceptT e) Source # | |
| MonadTrans (Conduit i o) Source # | |
Constructors
| Identity | |
Fields
| |
Instances
replicateM :: Applicative m => CountOf a -> m a -> m [a] Source #
performs the action replicateM n actn times,
gathering the results.