foundation-0.0.29: Alternative prelude with batteries and no dependencies
Safe Haskell None
Language Haskell2010

Foundation.Monad

Synopsis

Documentation

class Monad m => MonadIO (m :: Type -> Type ) where Source #

Monads in which IO computations may be embedded. Any monad built by applying a sequence of monad transformers to the IO monad will be an instance of this class.

Instances should satisfy the following laws, which state that liftIO is a transformer of monads:

Methods

liftIO :: IO a -> m a Source #

Lift a computation from the IO monad.

class Monad m => MonadFailure (m :: Type -> Type ) where Source #

Monad that can represent failure

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

Associated Types

type Failure (m :: Type -> Type ) Source #

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

Methods

mFail :: Failure m -> m () Source #

Raise a Failure through a monad.

Instances

Instances details
MonadFailure Maybe
Instance details

Defined in Basement.Monad

Associated Types

type Failure Maybe Source #

MonadFailure ( Either a)
Instance details

Defined in Basement.Monad

Associated Types

type Failure ( Either a) Source #

( Functor m, MonadFailure m) => MonadFailure ( StateT s m) Source #
Instance details

Defined in Foundation.Monad.State

Associated Types

type Failure ( StateT s m) Source #

MonadFailure m => MonadFailure ( ReaderT r m) Source #
Instance details

Defined in Foundation.Monad.Reader

Associated Types

type Failure ( ReaderT r m) Source #

Monad m => MonadFailure ( ExceptT e m) Source #
Instance details

Defined in Foundation.Monad.Except

Associated Types

type Failure ( ExceptT e m) Source #

MonadFailure m => MonadFailure ( Conduit i o m) Source #
Instance details

Defined in Foundation.Conduit.Internal

Associated Types

type Failure ( Conduit i o m) Source #

Monad state => MonadFailure ( Builder collection mutCollection step state err)
Instance details

Defined in Basement.MutableBuilder

Associated Types

type Failure ( Builder collection mutCollection step state err) Source #

Methods

mFail :: Failure ( Builder collection mutCollection step state err) -> Builder collection mutCollection step state err () Source #

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

class MonadThrow m => MonadCatch m where Source #

Monad that can catch exception

Methods

catch :: Exception e => m a -> (e -> m a) -> m a 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

generalBracket Source #

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

Instances details
MonadBracket IO Source #
Instance details

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 #
Instance details

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 #
Instance details

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

newtype Identity a Source #

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

Since: base-4.8.0.0

Constructors

Identity

Fields

Instances

Instances details
Monad Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Functor Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

MonadFix Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Applicative Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Foldable Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Traversable Identity

Since: base-4.9.0.0

Instance details

Defined in Data.Traversable

Bounded a => Bounded ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Enum a => Enum ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Eq a => Eq ( Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Floating a => Floating ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Fractional a => Fractional ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Integral a => Integral ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Data a => Data ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Data

Methods

gfoldl :: ( forall d b. Data d => c (d -> b) -> d -> c b) -> ( forall g. g -> c g) -> Identity a -> c ( Identity a) Source #

gunfold :: ( forall b r. Data b => c (b -> r) -> c r) -> ( forall r. r -> c r) -> Constr -> c ( Identity a) Source #

toConstr :: Identity a -> Constr Source #

dataTypeOf :: Identity a -> DataType Source #

dataCast1 :: Typeable t => ( forall d. Data d => c (t d)) -> Maybe (c ( Identity a)) Source #

dataCast2 :: Typeable t => ( forall d e. ( Data d, Data e) => c (t d e)) -> Maybe (c ( Identity a)) Source #

gmapT :: ( forall b. Data b => b -> b) -> Identity a -> Identity a Source #

gmapQl :: (r -> r' -> r) -> r -> ( forall d. Data d => d -> r') -> Identity a -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> ( forall d. Data d => d -> r') -> Identity a -> r Source #

gmapQ :: ( forall d. Data d => d -> u) -> Identity a -> [u] Source #

gmapQi :: Int -> ( forall d. Data d => d -> u) -> Identity a -> u Source #

gmapM :: Monad m => ( forall d. Data d => d -> m d) -> Identity a -> m ( Identity a) Source #

gmapMp :: MonadPlus m => ( forall d. Data d => d -> m d) -> Identity a -> m ( Identity a) Source #

gmapMo :: MonadPlus m => ( forall d. Data d => d -> m d) -> Identity a -> m ( Identity a) Source #

Num a => Num ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Ord a => Ord ( Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Read a => Read ( Identity a)

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

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Real a => Real ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

RealFloat a => RealFloat ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

RealFrac a => RealFrac ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Show a => Show ( Identity a)

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

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Ix a => Ix ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

IsString a => IsString ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.String

Generic ( Identity a)

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Associated Types

type Rep ( Identity a) :: Type -> Type Source #

Semigroup a => Semigroup ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Monoid a => Monoid ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Storable a => Storable ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Bits a => Bits ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

FiniteBits a => FiniteBits ( Identity a)

Since: base-4.9.0.0

Instance details

Defined in Data.Functor.Identity

Generic1 Identity

Since: base-4.8.0.0

Instance details

Defined in Data.Functor.Identity

Associated Types

type Rep1 Identity :: k -> Type Source #

type Rep ( Identity a)
Instance details

Defined in Data.Functor.Identity

type Rep ( Identity a) = D1 (' MetaData "Identity" "Data.Functor.Identity" "base" ' True ) ( C1 (' MetaCons "Identity" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "runIdentity") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 a)))
type Rep1 Identity
Instance details

Defined in Data.Functor.Identity

type Rep1 Identity = D1 (' MetaData "Identity" "Data.Functor.Identity" "base" ' True ) ( C1 (' MetaCons "Identity" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "runIdentity") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) Par1 ))

replicateM :: Applicative m => CountOf a -> m a -> m [a] Source #

replicateM n act performs the action n times, gathering the results.