Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class (HFunctor sig, Monad m) => Carrier sig m | m -> sig
- class HFunctor sig => Effect sig
- data PureC a
- data Pure (m :: * -> *) k
- run :: PureC a -> a
- class Member (sub :: (* -> *) -> * -> *) sup
- data (f :+: g) (m :: * -> *) k
- send :: (Member effect sig, Carrier sig m) => effect m (m a) -> m a
- data State s (m :: * -> *) k
- data StateC s m a
- data ReaderC r m a
- data Reader r m k
- data ResourceC m a
- data Resource m k
- data RandomC g m a
- data Random m k
- data NonDetC m a
- data NonDet (m :: * -> *) k
- data LiftC m a
- data Lift sig (m :: * -> *) k
- runM :: LiftC m a -> m a
- data FreshC m a
- data Fresh m k
- data ErrorC e m a
- data Error exc m k
- data ResumableWithC err m a
- data ResumableC err m a
- data Resumable err (m :: * -> *) k
- data FailC m a
- data Fail (m :: * -> *) k
- data CutC m a
- data Cut m k
- data OnceC m a
- data CullC m a
- data Cull m k
- data TraceByReturningC m a
- data TraceByIgnoringC m a
- data TraceByPrintingC m a
- data Trace (m :: * -> *) k
- data WriterC w m a
- data Writer w m k
- type Eff m = m
Documentation
class (HFunctor sig, Monad m) => Carrier sig m | m -> sig Source #
The class of carriers (results) for algebras (effect handlers) over signatures (effects), whose actions are given by the eff
method.
Instances
class HFunctor sig => Effect sig Source #
The class of effect types, which must:
- Be functorial in their last two arguments, and
- Support threading effects in higher-order positions through using the carrier’s suspended state.
Instances
Effect Pure Source # | |
Effect Resource Source # | |
Effect Random Source # | |
Effect NonDet Source # | |
Effect Fresh Source # | |
Effect Fail Source # | |
Effect Cut Source # | |
Effect Cull Source # | |
Effect Trace Source # | |
Effect (State s) Source # | |
Effect (Reader r) Source # | |
Functor sig => Effect (Lift sig) Source # | |
Effect (Error exc) Source # | |
Effect (Resumable err) Source # | |
Effect (Writer w) Source # | |
(Effect l, Effect r) => Effect (l :+: r) Source # | |
data (f :+: g) (m :: * -> *) k infixr 4 Source #
Instances
send :: (Member effect sig, Carrier sig m) => effect m (m a) -> m a Source #
Construct a request for an effect to be interpreted by some handler later on.
Instances
MonadTrans (StateC s) Source # | |
Defined in Control.Effect.State.Strict | |
Monad m => Monad (StateC s m) Source # | |
Functor m => Functor (StateC s m) Source # | |
MonadFail m => MonadFail (StateC s m) Source # | |
Defined in Control.Effect.State.Strict | |
Monad m => Applicative (StateC s m) Source # | |
Defined in Control.Effect.State.Strict | |
MonadIO m => MonadIO (StateC s m) Source # | |
Defined in Control.Effect.State.Strict | |
(Alternative m, Monad m) => Alternative (StateC s m) Source # | |
(Alternative m, Monad m) => MonadPlus (StateC s m) Source # | |
(Carrier sig m, Effect sig) => Carrier (State s :+: sig) (StateC s m) Source # | |
Instances
MonadTrans (ReaderC r) Source # | |
Defined in Control.Effect.Reader | |
Monad m => Monad (ReaderC r m) Source # | |
Functor m => Functor (ReaderC r m) Source # | |
MonadFail m => MonadFail (ReaderC r m) Source # | |
Defined in Control.Effect.Reader | |
Applicative m => Applicative (ReaderC r m) Source # | |
Defined in Control.Effect.Reader | |
MonadIO m => MonadIO (ReaderC r m) Source # | |
Defined in Control.Effect.Reader | |
Alternative m => Alternative (ReaderC r m) Source # | |
(Alternative m, Monad m) => MonadPlus (ReaderC r m) Source # | |
MonadUnliftIO m => MonadUnliftIO (ReaderC r m) Source # | |
Defined in Control.Effect.Reader askUnliftIO :: ReaderC r m (UnliftIO (ReaderC r m)) withRunInIO :: ((forall a. ReaderC r m a -> IO a) -> IO b) -> ReaderC r m b | |
Carrier sig m => Carrier (Reader r :+: sig) (ReaderC r m) Source # | |
Instances
MonadTrans ResourceC Source # | |
Defined in Control.Effect.Resource | |
Monad m => Monad (ResourceC m) Source # | |
Functor m => Functor (ResourceC m) Source # | |
MonadFail m => MonadFail (ResourceC m) Source # | |
Defined in Control.Effect.Resource | |
Applicative m => Applicative (ResourceC m) Source # | |
Defined in Control.Effect.Resource | |
MonadIO m => MonadIO (ResourceC m) Source # | |
Defined in Control.Effect.Resource | |
Alternative m => Alternative (ResourceC m) Source # | |
(Alternative m, Monad m) => MonadPlus (ResourceC m) Source # | |
MonadUnliftIO m => MonadUnliftIO (ResourceC m) Source # | |
Defined in Control.Effect.Resource askUnliftIO :: ResourceC m (UnliftIO (ResourceC m)) withRunInIO :: ((forall a. ResourceC m a -> IO a) -> IO b) -> ResourceC m b | |
(Carrier sig m, MonadIO m) => Carrier (Resource :+: sig) (ResourceC m) Source # | |
Instances
A carrier for NonDet
effects based on Ralf Hinze’s design described in Deriving Backtracking Monad Transformers.
Instances
MonadTrans NonDetC Source # | |
Defined in Control.Effect.NonDet | |
Monad (NonDetC m) Source # | |
Functor (NonDetC m) Source # | |
MonadFail m => MonadFail (NonDetC m) Source # | |
Defined in Control.Effect.NonDet | |
Applicative (NonDetC m) Source # | |
MonadIO m => MonadIO (NonDetC m) Source # | |
Defined in Control.Effect.NonDet | |
Alternative (NonDetC m) Source # | |
MonadPlus (NonDetC m) Source # | |
(Carrier sig m, Effect sig) => Carrier (NonDet :+: sig) (NonDetC m) Source # | |
data NonDet (m :: * -> *) k Source #
Instances
Effect NonDet Source # | |
HFunctor NonDet Source # | |
Functor (NonDet m) Source # | |
(Carrier sig m, Effect sig) => Carrier (NonDet :+: sig) (NonDetC m) Source # | |
(Carrier sig m, Effect sig) => Carrier (NonDet :+: sig) (OnceC m) Source # | |
(Carrier sig m, Effect sig) => Carrier (Cut :+: (NonDet :+: sig)) (CutC m) Source # | |
(Carrier sig m, Effect sig) => Carrier (Cull :+: (NonDet :+: sig)) (CullC m) Source # | |
Instances
MonadTrans LiftC Source # | |
Defined in Control.Effect.Lift | |
Monad m => Monad (LiftC m) Source # | |
Functor m => Functor (LiftC m) Source # | |
MonadFail m => MonadFail (LiftC m) Source # | |
Defined in Control.Effect.Lift | |
Applicative m => Applicative (LiftC m) Source # | |
MonadIO m => MonadIO (LiftC m) Source # | |
Defined in Control.Effect.Lift | |
Alternative m => Alternative (LiftC m) Source # | |
MonadPlus m => MonadPlus (LiftC m) Source # | |
MonadUnliftIO m => MonadUnliftIO (LiftC m) Source # | |
Defined in Control.Effect.Lift askUnliftIO :: LiftC m (UnliftIO (LiftC m)) withRunInIO :: ((forall a. LiftC m a -> IO a) -> IO b) -> LiftC m b | |
Monad m => Carrier (Lift m) (LiftC m) Source # | |
Instances
MonadTrans FreshC Source # | |
Defined in Control.Effect.Fresh | |
Monad m => Monad (FreshC m) Source # | |
Functor m => Functor (FreshC m) Source # | |
MonadFail m => MonadFail (FreshC m) Source # | |
Defined in Control.Effect.Fresh | |
Monad m => Applicative (FreshC m) Source # | |
MonadIO m => MonadIO (FreshC m) Source # | |
Defined in Control.Effect.Fresh | |
(Alternative m, Monad m) => Alternative (FreshC m) Source # | |
(Alternative m, Monad m) => MonadPlus (FreshC m) Source # | |
(Carrier sig m, Effect sig) => Carrier (Fresh :+: sig) (FreshC m) Source # | |
Instances
MonadTrans (ErrorC e) Source # | |
Defined in Control.Effect.Error | |
Monad m => Monad (ErrorC e m) Source # | |
Functor m => Functor (ErrorC e m) Source # | |
MonadFail m => MonadFail (ErrorC e m) Source # | |
Defined in Control.Effect.Error | |
Applicative m => Applicative (ErrorC e m) Source # | |
Defined in Control.Effect.Error | |
MonadIO m => MonadIO (ErrorC e m) Source # | |
Defined in Control.Effect.Error | |
Alternative m => Alternative (ErrorC e m) Source # | |
(Alternative m, Monad m) => MonadPlus (ErrorC e m) Source # | |
(Carrier sig m, Effect sig) => Carrier (Error e :+: sig) (ErrorC e m) Source # | |
data ResumableWithC err m a Source #
Instances
data ResumableC err m a Source #
Instances
data Resumable err (m :: * -> *) k Source #
Errors which can be resumed with values of some existentially-quantified type.
Instances
Effect (Resumable err) Source # | |
HFunctor (Resumable err) Source # | |
Functor (Resumable err m) Source # | |
Carrier sig m => Carrier (Resumable err :+: sig) (ResumableWithC err m) Source # | |
Defined in Control.Effect.Resumable eff :: (Resumable err :+: sig) (ResumableWithC err m) (ResumableWithC err m a) -> ResumableWithC err m a Source # ret :: a -> ResumableWithC err m a Source # | |
(Carrier sig m, Effect sig) => Carrier (Resumable err :+: sig) (ResumableC err m) Source # | |
Defined in Control.Effect.Resumable eff :: (Resumable err :+: sig) (ResumableC err m) (ResumableC err m a) -> ResumableC err m a Source # ret :: a -> ResumableC err m a Source # |
Instances
MonadTrans FailC Source # | |
Defined in Control.Effect.Fail | |
Monad m => Monad (FailC m) Source # | |
Functor m => Functor (FailC m) Source # | |
(Carrier sig m, Effect sig) => MonadFail (FailC m) Source # | |
Defined in Control.Effect.Fail | |
Applicative m => Applicative (FailC m) Source # | |
MonadIO m => MonadIO (FailC m) Source # | |
Defined in Control.Effect.Fail | |
Alternative m => Alternative (FailC m) Source # | |
(Alternative m, Monad m) => MonadPlus (FailC m) Source # | |
(Carrier sig m, Effect sig) => Carrier (Fail :+: sig) (FailC m) Source # | |
Instances
MonadTrans CutC Source # | |
Defined in Control.Effect.Cut | |
Monad (CutC m) Source # | |
Functor (CutC m) Source # | |
MonadFail m => MonadFail (CutC m) Source # | |
Defined in Control.Effect.Cut | |
Applicative (CutC m) Source # | |
MonadIO m => MonadIO (CutC m) Source # | |
Defined in Control.Effect.Cut | |
Alternative (CutC m) Source # | |
MonadPlus (CutC m) Source # | |
(Carrier sig m, Effect sig) => Carrier (Cut :+: (NonDet :+: sig)) (CutC m) Source # | |
Instances
Monad (OnceC m) Source # | |
Functor (OnceC m) Source # | |
MonadFail m => MonadFail (OnceC m) Source # | |
Defined in Control.Effect.Cull | |
Applicative (OnceC m) Source # | |
MonadIO m => MonadIO (OnceC m) Source # | |
Defined in Control.Effect.Cull | |
Alternative (OnceC m) Source # | |
MonadPlus (OnceC m) Source # | |
(Carrier sig m, Effect sig) => Carrier (NonDet :+: sig) (OnceC m) Source # | |
Instances
MonadTrans CullC Source # | |
Defined in Control.Effect.Cull | |
Monad (CullC m) Source # | |
Functor (CullC m) Source # | |
MonadFail m => MonadFail (CullC m) Source # | |
Defined in Control.Effect.Cull | |
Applicative (CullC m) Source # | |
MonadIO m => MonadIO (CullC m) Source # | |
Defined in Control.Effect.Cull | |
Alternative (CullC m) Source # | |
MonadPlus (CullC m) Source # | |
(Carrier sig m, Effect sig) => Carrier (Cull :+: (NonDet :+: sig)) (CullC m) Source # | |
data TraceByReturningC m a Source #
Instances
data TraceByIgnoringC m a Source #
Instances
data TraceByPrintingC m a Source #
Instances
data Trace (m :: * -> *) k Source #
Instances
Effect Trace Source # | |
HFunctor Trace Source # | |
Functor (Trace m) Source # | |
(Carrier sig m, Effect sig) => Carrier (Trace :+: sig) (TraceByReturningC m) Source # | |
Defined in Control.Effect.Trace eff :: (Trace :+: sig) (TraceByReturningC m) (TraceByReturningC m a) -> TraceByReturningC m a Source # ret :: a -> TraceByReturningC m a Source # | |
Carrier sig m => Carrier (Trace :+: sig) (TraceByIgnoringC m) Source # | |
Defined in Control.Effect.Trace eff :: (Trace :+: sig) (TraceByIgnoringC m) (TraceByIgnoringC m a) -> TraceByIgnoringC m a Source # ret :: a -> TraceByIgnoringC m a Source # | |
(MonadIO m, Carrier sig m) => Carrier (Trace :+: sig) (TraceByPrintingC m) Source # | |
Defined in Control.Effect.Trace eff :: (Trace :+: sig) (TraceByPrintingC m) (TraceByPrintingC m a) -> TraceByPrintingC m a Source # ret :: a -> TraceByPrintingC m a Source # |
A space-efficient carrier for Writer
effects.
This is based on a post Gabriel Gonzalez made to the Haskell mailing list: https://mail.haskell.org/pipermail/libraries/2013-March/019528.html
Instances
MonadTrans (WriterC w) Source # | |
Defined in Control.Effect.Writer | |
Monad m => Monad (WriterC w m) Source # | |
Functor m => Functor (WriterC w m) Source # | |
MonadFail m => MonadFail (WriterC w m) Source # | |
Defined in Control.Effect.Writer | |
Monad m => Applicative (WriterC w m) Source # | |
Defined in Control.Effect.Writer | |
MonadIO m => MonadIO (WriterC w m) Source # | |
Defined in Control.Effect.Writer | |
(Alternative m, Monad m) => Alternative (WriterC w m) Source # | |
(Alternative m, Monad m) => MonadPlus (WriterC w m) Source # | |
(Monoid w, Carrier sig m, Effect sig) => Carrier (Writer w :+: sig) (WriterC w m) Source # | |