foundation-0.0.13: Alternative prelude with batteries and no dependencies

Safe HaskellNone
LanguageHaskell2010

Foundation.Monad

Synopsis

Documentation

class Monad m => MonadIO m where

Monads in which IO computations may be embedded.

Methods

liftIO :: IO a -> m a

Lift a computation from the IO monad.

Instances

MonadIO IO 
MonadIO m => MonadIO (ResourceT m) 
MonadIO m => MonadIO (ReaderT r m) 
(Functor m, MonadIO m) => MonadIO (StateT s m) 
MonadIO m => MonadIO (Conduit i o m) 

class Monad m => MonadFailure m where

Monad that can represent failure

Similar to MonadFail but with a parametrized Failure linked to the Monad

Associated Types

type Failure m

The associated type with the MonadFailure, representing what failure can be encoded in this monad

Methods

mFail :: Failure m -> m ()

Raise a Failure through a monad.

Instances

MonadFailure Maybe 
MonadFailure (Either a) 
MonadFailure m => MonadFailure (ReaderT r m) 
(Functor m, MonadFailure m) => MonadFailure (StateT s m) 
MonadFailure m => MonadFailure (Conduit i o m) 
Monad state => MonadFailure (Builder collection mutCollection step state err) 

class Monad m => MonadThrow m where

Monad that can throw exception

Methods

throw :: Exception e => e -> m a

Throw immediatity an exception. Only a MonadCatch monad will be able to catch the exception using catch

class MonadThrow m => MonadCatch m where

Monad that can catch exception

Methods

catch :: Exception e => m a -> (e -> m a) -> m a

class MonadCatch m => MonadBracket m where

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

generalBracket

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.

class MonadTrans trans where

Basic Transformer class

Methods

lift :: Monad m => m a -> trans m a

Lift a computation from an inner monad to the current transformer monad

newtype Identity a :: * -> *

Identity functor and monad. (a non-strict monad)

Since: 4.8.0.0

Constructors

Identity 

Fields

runIdentity :: a
 

Instances

Monad Identity 
Functor Identity 
MonadFix Identity 
Applicative Identity 
Foldable Identity 
Traversable Identity 
Generic1 Identity 
MonadZip Identity 
Eq a => Eq (Identity a) 
Data a => Data (Identity a) 
Ord a => Ord (Identity a) 
Read a => Read (Identity a)

This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed

Show a => Show (Identity a)

This instance would be equivalent to the derived instances of the Identity newtype if the runIdentity field were removed

Generic (Identity a) 
type Rep1 Identity = D1 D1Identity (C1 C1_0Identity (S1 S1_0_0Identity Par1)) 
type Rep (Identity a) = D1 D1Identity (C1 C1_0Identity (S1 S1_0_0Identity (Rec0 a)))