fused-effects-1.0.2.1: A fast, flexible, fused effect system.

Safe HaskellNone
LanguageHaskell2010

Control.Algebra

Contents

Description

The Algebra class is the mechanism with which effects are interpreted.

An instance of the Algebra class defines an interpretation of an effect signature atop a given monad.

Since: 1.0.0.0

Synopsis

Documentation

class Monad m => Algebra sig m | m -> sig where Source #

The class of carriers (results) for algebras (effect handlers) over signatures (effects), whose actions are given by the alg method.

Since: 1.0.0.0

Methods

alg Source #

Arguments

:: Functor ctx 
=> Handler ctx n m

A Handler lowering computations inside the effect into the carrier type m.

-> sig n a

The effect signature to be interpreted.

-> ctx ()

The initial state.

-> m (ctx a)

The interpretation of the effect in m.

Interpret an effect, running any nested actions using a Handler starting from an initial state in ctx.

Instances receive a signature of effects containing actions in n which can be lowered to m using the passed Handler and initial context. Continuations in n can be handled after mapping into contexts returned from previous actions.

For example, considering the Algebra instance for Either e:

instance Algebra (Error e) (Either e) where
  alg hdl sig ctx = case sig of
    L (Throw e)   -> Left e
    R (Catch m h) -> either (hdl . (<$ ctx) . h) pure (hdl (m <$ ctx))

The Catch case holds actions m :: n x and h :: e -> n x (for some existentially-quantified type x), and a continuation k :: x -> n a. The algebra must return m (ctx a), so we have to ultimately use and lower the continuation in order to produce that type. The continuation takes an x, which we can get from either of the actions, after lowering them to values in Either e.

To that end, the algebra lifts both the action m and the result of the error handler h into the initial context ctx before lowering them with hdl. The continuation k is fmaped into the resulting context and then itself lowered with hdl.

By contrast, the Throw case can simply return a value in Left, since there is no continuation to call—it represents an exceptional return—and Left e :: forall a . Either e a (i.e. Left is polymorphic in a).

Instances for monad transformers will most likely handle a signature containing multiple effects, with the tail of the signature handled by whatever monad the transformer wraps. In these cases, the tail of the signature can be delegated most conveniently using thread; see the Algebra instances for transformers types such as ReaderT and ExceptT for details.

Instances
Algebra Choose NonEmpty Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n NonEmpty -> Choose n a -> ctx () -> NonEmpty (ctx a) Source #

Algebra Empty Maybe Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n Maybe -> Empty n a -> ctx () -> Maybe (ctx a) Source #

Algebra NonDet [] Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n [] -> NonDet n a -> ctx () -> [ctx a] Source #

Algebra sig m => Algebra sig (Alt m) Source #

This instance permits effectful actions to be lifted into the Alt monad, which eases the invocation of repeated alternation with <|>:

a <|> b <|> c <|> d

is equivalent to

getAlt (mconcat [a, b, c, d])

Since: 1.0.1.0

Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (Alt m) -> sig n a -> ctx () -> Alt m (ctx a) Source #

Algebra sig m => Algebra sig (Ap m) Source #

This instance permits effectful actions to be lifted into the Ap monad given a monoidal return type, which can provide clarity when chaining calls to mappend.

mappend <$> act1 <*> (mappend <$> act2 <*> act3)

is equivalent to

getAp (act1 <> act2 <> act3)

Since: 1.0.1.0

Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (Ap m) -> sig n a -> ctx () -> Ap m (ctx a) Source #

Algebra sig m => Algebra sig (IdentityT m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (IdentityT m) -> sig n a -> ctx () -> IdentityT m (ctx a) Source #

Algebra (Lift IO) IO Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n IO -> Lift IO n a -> ctx () -> IO (ctx a) Source #

Algebra (Lift Identity) Identity Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n Identity -> Lift Identity n a -> ctx () -> Identity (ctx a) Source #

Monad m => Algebra (Lift m) (LiftC m) Source # 
Instance details

Defined in Control.Carrier.Lift

Methods

alg :: Functor ctx => Handler ctx n (LiftC m) -> Lift m n a -> ctx () -> LiftC m (ctx a) Source #

Algebra (Error e) (Either e) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (Either e) -> Error e n a -> ctx () -> Either e (ctx a) Source #

Monoid w => Algebra (Writer w) ((,) w) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n ((,) w) -> Writer w n a -> ctx () -> (w, ctx a) Source #

Algebra (Reader r) ((->) r :: Type -> Type) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n ((->) r) -> Reader r n a -> ctx () -> r -> ctx a Source #

Algebra sig m => Algebra (Choose :+: sig) (ChooseC m) Source # 
Instance details

Defined in Control.Carrier.Choose.Church

Methods

alg :: Functor ctx => Handler ctx n (ChooseC m) -> (Choose :+: sig) n a -> ctx () -> ChooseC m (ctx a) Source #

Algebra sig m => Algebra (Empty :+: sig) (MaybeT m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (MaybeT m) -> (Empty :+: sig) n a -> ctx () -> MaybeT m (ctx a) Source #

Algebra sig m => Algebra (Empty :+: sig) (EmptyC m) Source # 
Instance details

Defined in Control.Carrier.Empty.Maybe

Methods

alg :: Functor ctx => Handler ctx n (EmptyC m) -> (Empty :+: sig) n a -> ctx () -> EmptyC m (ctx a) Source #

Algebra sig m => Algebra (Empty :+: sig) (EmptyC m) Source # 
Instance details

Defined in Control.Carrier.Empty.Church

Methods

alg :: Functor ctx => Handler ctx n (EmptyC m) -> (Empty :+: sig) n a -> ctx () -> EmptyC m (ctx a) Source #

Algebra sig m => Algebra (NonDet :+: sig) (NonDetC m) Source # 
Instance details

Defined in Control.Carrier.NonDet.Church

Methods

alg :: Functor ctx => Handler ctx n (NonDetC m) -> (NonDet :+: sig) n a -> ctx () -> NonDetC m (ctx a) Source #

(MonadIO m, Algebra sig m) => Algebra (Trace :+: sig) (TraceC m) Source # 
Instance details

Defined in Control.Carrier.Trace.Printing

Methods

alg :: Functor ctx => Handler ctx n (TraceC m) -> (Trace :+: sig) n a -> ctx () -> TraceC m (ctx a) Source #

Algebra sig m => Algebra (Trace :+: sig) (TraceC m) Source # 
Instance details

Defined in Control.Carrier.Trace.Ignoring

Methods

alg :: Functor ctx => Handler ctx n (TraceC m) -> (Trace :+: sig) n a -> ctx () -> TraceC m (ctx a) Source #

Algebra sig m => Algebra (Trace :+: sig) (TraceC m) Source # 
Instance details

Defined in Control.Carrier.Trace.Returning

Methods

alg :: Functor ctx => Handler ctx n (TraceC m) -> (Trace :+: sig) n a -> ctx () -> TraceC m (ctx a) Source #

Algebra sig m => Algebra (Fail :+: sig) (FailC m) Source # 
Instance details

Defined in Control.Carrier.Fail.Either

Methods

alg :: Functor ctx => Handler ctx n (FailC m) -> (Fail :+: sig) n a -> ctx () -> FailC m (ctx a) Source #

Algebra sig m => Algebra (Fresh :+: sig) (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Strict

Methods

alg :: Functor ctx => Handler ctx n (FreshC m) -> (Fresh :+: sig) n a -> ctx () -> FreshC m (ctx a) Source #

Algebra sig m => Algebra (Fresh :+: sig) (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Church

Methods

alg :: Functor ctx => Handler ctx n (FreshC m) -> (Fresh :+: sig) n a -> ctx () -> FreshC m (ctx a) Source #

Algebra sig m => Algebra (Cut :+: (NonDet :+: sig)) (CutC m) Source # 
Instance details

Defined in Control.Carrier.Cut.Church

Methods

alg :: Functor ctx => Handler ctx n (CutC m) -> (Cut :+: (NonDet :+: sig)) n a -> ctx () -> CutC m (ctx a) Source #

Algebra sig m => Algebra (Cull :+: (NonDet :+: sig)) (CullC m) Source # 
Instance details

Defined in Control.Carrier.Cull.Church

Methods

alg :: Functor ctx => Handler ctx n (CullC m) -> (Cull :+: (NonDet :+: sig)) n a -> ctx () -> CullC m (ctx a) Source #

Algebra sig m => Algebra (Reader r :+: sig) (ReaderC r m) Source # 
Instance details

Defined in Control.Carrier.Reader

Methods

alg :: Functor ctx => Handler ctx n (ReaderC r m) -> (Reader r :+: sig) n a -> ctx () -> ReaderC r m (ctx a) Source #

Algebra sig m => Algebra (State s :+: sig) (StateT s m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (StateT s m) -> (State s :+: sig) n a -> ctx () -> StateT s m (ctx a) Source #

Algebra sig m => Algebra (State s :+: sig) (StateT s m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (StateT s m) -> (State s :+: sig) n a -> ctx () -> StateT s m (ctx a) Source #

Algebra sig m => Algebra (State s :+: sig) (StateC s m) Source # 
Instance details

Defined in Control.Carrier.State.Strict

Methods

alg :: Functor ctx => Handler ctx n (StateC s m) -> (State s :+: sig) n a -> ctx () -> StateC s m (ctx a) Source #

Algebra sig m => Algebra (State s :+: sig) (StateC s m) Source # 
Instance details

Defined in Control.Carrier.State.Lazy

Methods

alg :: Functor ctx => Handler ctx n (StateC s m) -> (State s :+: sig) n a -> ctx () -> StateC s m (ctx a) Source #

Algebra sig m => Algebra (State s :+: sig) (StateC s m) Source # 
Instance details

Defined in Control.Carrier.State.Church

Methods

alg :: Functor ctx => Handler ctx n (StateC s m) -> (State s :+: sig) n a -> ctx () -> StateC s m (ctx a) Source #

Algebra sig m => Algebra (Throw e :+: sig) (ThrowC e m) Source # 
Instance details

Defined in Control.Carrier.Throw.Either

Methods

alg :: Functor ctx => Handler ctx n (ThrowC e m) -> (Throw e :+: sig) n a -> ctx () -> ThrowC e m (ctx a) Source #

Algebra sig m => Algebra (Error e :+: sig) (ExceptT e m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (ExceptT e m) -> (Error e :+: sig) n a -> ctx () -> ExceptT e m (ctx a) Source #

Algebra sig m => Algebra (Error e :+: sig) (ErrorC e m) Source # 
Instance details

Defined in Control.Carrier.Error.Either

Methods

alg :: Functor ctx => Handler ctx n (ErrorC e m) -> (Error e :+: sig) n a -> ctx () -> ErrorC e m (ctx a) Source #

Algebra sig m => Algebra (Error e :+: sig) (ErrorC e m) Source # 
Instance details

Defined in Control.Carrier.Error.Church

Methods

alg :: Functor ctx => Handler ctx n (ErrorC e m) -> (Error e :+: sig) n a -> ctx () -> ErrorC e m (ctx a) Source #

(Algebra sig m, Monoid w) => Algebra (Writer w :+: sig) (WriterT w m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (WriterT w m) -> (Writer w :+: sig) n a -> ctx () -> WriterT w m (ctx a) Source #

(Algebra sig m, Monoid w) => Algebra (Writer w :+: sig) (WriterT w m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (WriterT w m) -> (Writer w :+: sig) n a -> ctx () -> WriterT w m (ctx a) Source #

(Monoid w, Algebra sig m) => Algebra (Writer w :+: sig) (WriterC w m) Source # 
Instance details

Defined in Control.Carrier.Writer.Strict

Methods

alg :: Functor ctx => Handler ctx n (WriterC w m) -> (Writer w :+: sig) n a -> ctx () -> WriterC w m (ctx a) Source #

(Algebra sig m, Monoid w) => Algebra (Writer w :+: sig) (WriterC w m) Source # 
Instance details

Defined in Control.Carrier.Writer.Church

Methods

alg :: Functor ctx => Handler ctx n (WriterC w m) -> (Writer w :+: sig) n a -> ctx () -> WriterC w m (ctx a) Source #

(Reifies s (Interpreter eff m), Algebra sig m) => Algebra (eff :+: sig) (InterpretC s eff m) Source # 
Instance details

Defined in Control.Carrier.Interpret

Methods

alg :: Functor ctx => Handler ctx n (InterpretC s eff m) -> (eff :+: sig) n a -> ctx () -> InterpretC s eff m (ctx a) Source #

Algebra sig m => Algebra (Reader r :+: sig) (ReaderT r m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (ReaderT r m) -> (Reader r :+: sig) n a -> ctx () -> ReaderT r m (ctx a) Source #

(LabelledMember label sub sig, Algebra sig m) => Algebra (sub :+: sig) (UnderLabel label sub m) Source # 
Instance details

Defined in Control.Effect.Labelled

Methods

alg :: Functor ctx => Handler ctx n (UnderLabel label sub m) -> (sub :+: sig) n a -> ctx () -> UnderLabel label sub m (ctx a) Source #

(Algebra sig m, Monoid w) => Algebra (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (RWST r w s m) -> (Reader r :+: (Writer w :+: (State s :+: sig))) n a -> ctx () -> RWST r w s m (ctx a) Source #

(Algebra sig m, Monoid w) => Algebra (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (RWST r w s m) -> (Reader r :+: (Writer w :+: (State s :+: sig))) n a -> ctx () -> RWST r w s m (ctx a) Source #

Algebra (eff :+: sig) (sub m) => Algebra (Labelled label eff :+: sig) (Labelled label sub m) Source # 
Instance details

Defined in Control.Effect.Labelled

Methods

alg :: Functor ctx => Handler ctx n (Labelled label sub m) -> (Labelled label eff :+: sig) n a -> ctx () -> Labelled label sub m (ctx a) Source #

thread :: (Functor ctx1, Functor ctx2, Algebra sig m) => Handler (Compose ctx1 ctx2) n m -> sig n a -> ctx1 (ctx2 ()) -> m (ctx1 (ctx2 a)) Source #

Thread a composed handler and input state through the algebra for some underlying signature.

Since: 1.1.0.0

run :: Identity a -> a Source #

Run an action exhausted of effects to produce its final result value.

Since: 1.0.0.0

type Has eff sig m = (Members eff sig, Algebra sig m) Source #

m is a carrier for sig containing eff.

Note that if eff is a sum, it will be decomposed into multiple Member constraints. While this technically allows one to combine multiple unrelated effects into a single Has constraint, doing so has two significant drawbacks:

  1. Due to a problem with recursive type families, this can lead to significantly slower compiles.
  2. It defeats ghc’s warnings for redundant constraints, and thus can lead to a proliferation of redundant constraints as code is changed.

Since: 1.0.0.0

send :: (Member eff sig, Algebra sig m) => eff m a -> m a Source #

Construct a request for an effect to be interpreted by some handler later on.

Since: 0.1.0.0

Re-exports

type Handler ctx m n = forall x. ctx (m x) -> n (ctx x) Source #

Handlers take an action in m bundled up with some state in some context functor ctx, and return an action in n producing a derived state in ctx.

These are expected to be well-behaved distributive laws, and are required to adhere to the following laws:

handler . fmap pure = pure
handler . fmap (k =<<) = handler . fmap k <=< handler

respectively expressing that the handler does not alter the context of pure computations, and that the handler distributes over monadic composition.

Handlers compose with handlers, using e.g. Data.Functor.Compose.Compose to ensure that the result is itself well-typed as a Handler:

fmap Compose . handler1 . fmap handler2 . getCompose

and with monad homomorphisms on the left and right:

hom . handler
handler . fmap hom

Since: 1.1.0.0

(~<~) :: (Functor n, Functor ctx1) => Handler ctx1 m n -> Handler ctx2 l m -> Handler (Compose ctx1 ctx2) l n infixr 1 Source #

Composition of handlers.

Since: 1.1.0.0

data (f :+: g) (m :: Type -> Type) k infixr 4 Source #

Higher-order sums are used to combine multiple effects into a signature, typically by chaining on the right.

Constructors

L (f m k) 
R (g m k) 
Instances
Algebra NonDet [] Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n [] -> NonDet n a -> ctx () -> [ctx a] Source #

LabelledMember label l r => LabelledMember (label :: k) l (l' :+: r) Source #

Right-recursion: if t is a member of r, we can inject it into r in O(n), followed by lifting that into l :+: r in O(1).

Instance details

Defined in Control.Effect.Labelled

Methods

injLabelled :: Labelled label l m a -> (l' :+: r) m a Source #

LabelledMember (label :: k) l (Labelled label l :+: r) Source #

Left-occurrence: if t is at the head of a signature, we can inject it in O(1).

Instance details

Defined in Control.Effect.Labelled

Methods

injLabelled :: Labelled label l m a -> (Labelled label l :+: r) m a Source #

LabelledMember label t (l1 :+: (l2 :+: r)) => LabelledMember (label :: k) t ((l1 :+: l2) :+: r) Source #

Left-recursion: if t is a member of l1 :+: l2 :+: r, then we can inject it into (l1 :+: l2) :+: r by injection into a right-recursive signature, followed by left-association.

Instance details

Defined in Control.Effect.Labelled

Methods

injLabelled :: Labelled label t m a -> ((l1 :+: l2) :+: r) m a Source #

Member l r => Member l (l' :+: r) Source #

Right-recursion: if t is a member of r, we can inject it into r in O(n), followed by lifting that into l :+: r in O(1).

Instance details

Defined in Control.Effect.Sum

Methods

inj :: l m a -> (l' :+: r) m a Source #

Member l (l :+: r) Source #

Left-occurrence: if t is at the head of a signature, we can inject it in O(1).

Instance details

Defined in Control.Effect.Sum

Methods

inj :: l m a -> (l :+: r) m a Source #

Member t (l1 :+: (l2 :+: r)) => Member t ((l1 :+: l2) :+: r) Source #

Left-recursion: if t is a member of l1 :+: l2 :+: r, then we can inject it into (l1 :+: l2) :+: r by injection into a right-recursive signature, followed by left-association.

Instance details

Defined in Control.Effect.Sum

Methods

inj :: t m a -> ((l1 :+: l2) :+: r) m a Source #

Algebra (Error e) (Either e) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (Either e) -> Error e n a -> ctx () -> Either e (ctx a) Source #

Algebra sig m => Algebra (Choose :+: sig) (ChooseC m) Source # 
Instance details

Defined in Control.Carrier.Choose.Church

Methods

alg :: Functor ctx => Handler ctx n (ChooseC m) -> (Choose :+: sig) n a -> ctx () -> ChooseC m (ctx a) Source #

Algebra sig m => Algebra (Empty :+: sig) (MaybeT m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (MaybeT m) -> (Empty :+: sig) n a -> ctx () -> MaybeT m (ctx a) Source #

Algebra sig m => Algebra (Empty :+: sig) (EmptyC m) Source # 
Instance details

Defined in Control.Carrier.Empty.Maybe

Methods

alg :: Functor ctx => Handler ctx n (EmptyC m) -> (Empty :+: sig) n a -> ctx () -> EmptyC m (ctx a) Source #

Algebra sig m => Algebra (Empty :+: sig) (EmptyC m) Source # 
Instance details

Defined in Control.Carrier.Empty.Church

Methods

alg :: Functor ctx => Handler ctx n (EmptyC m) -> (Empty :+: sig) n a -> ctx () -> EmptyC m (ctx a) Source #

Algebra sig m => Algebra (NonDet :+: sig) (NonDetC m) Source # 
Instance details

Defined in Control.Carrier.NonDet.Church

Methods

alg :: Functor ctx => Handler ctx n (NonDetC m) -> (NonDet :+: sig) n a -> ctx () -> NonDetC m (ctx a) Source #

(MonadIO m, Algebra sig m) => Algebra (Trace :+: sig) (TraceC m) Source # 
Instance details

Defined in Control.Carrier.Trace.Printing

Methods

alg :: Functor ctx => Handler ctx n (TraceC m) -> (Trace :+: sig) n a -> ctx () -> TraceC m (ctx a) Source #

Algebra sig m => Algebra (Trace :+: sig) (TraceC m) Source # 
Instance details

Defined in Control.Carrier.Trace.Ignoring

Methods

alg :: Functor ctx => Handler ctx n (TraceC m) -> (Trace :+: sig) n a -> ctx () -> TraceC m (ctx a) Source #

Algebra sig m => Algebra (Trace :+: sig) (TraceC m) Source # 
Instance details

Defined in Control.Carrier.Trace.Returning

Methods

alg :: Functor ctx => Handler ctx n (TraceC m) -> (Trace :+: sig) n a -> ctx () -> TraceC m (ctx a) Source #

Algebra sig m => Algebra (Fail :+: sig) (FailC m) Source # 
Instance details

Defined in Control.Carrier.Fail.Either

Methods

alg :: Functor ctx => Handler ctx n (FailC m) -> (Fail :+: sig) n a -> ctx () -> FailC m (ctx a) Source #

Algebra sig m => Algebra (Fresh :+: sig) (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Strict

Methods

alg :: Functor ctx => Handler ctx n (FreshC m) -> (Fresh :+: sig) n a -> ctx () -> FreshC m (ctx a) Source #

Algebra sig m => Algebra (Fresh :+: sig) (FreshC m) Source # 
Instance details

Defined in Control.Carrier.Fresh.Church

Methods

alg :: Functor ctx => Handler ctx n (FreshC m) -> (Fresh :+: sig) n a -> ctx () -> FreshC m (ctx a) Source #

Algebra sig m => Algebra (Cut :+: (NonDet :+: sig)) (CutC m) Source # 
Instance details

Defined in Control.Carrier.Cut.Church

Methods

alg :: Functor ctx => Handler ctx n (CutC m) -> (Cut :+: (NonDet :+: sig)) n a -> ctx () -> CutC m (ctx a) Source #

Algebra sig m => Algebra (Cull :+: (NonDet :+: sig)) (CullC m) Source # 
Instance details

Defined in Control.Carrier.Cull.Church

Methods

alg :: Functor ctx => Handler ctx n (CullC m) -> (Cull :+: (NonDet :+: sig)) n a -> ctx () -> CullC m (ctx a) Source #

Algebra sig m => Algebra (Reader r :+: sig) (ReaderC r m) Source # 
Instance details

Defined in Control.Carrier.Reader

Methods

alg :: Functor ctx => Handler ctx n (ReaderC r m) -> (Reader r :+: sig) n a -> ctx () -> ReaderC r m (ctx a) Source #

Algebra sig m => Algebra (State s :+: sig) (StateT s m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (StateT s m) -> (State s :+: sig) n a -> ctx () -> StateT s m (ctx a) Source #

Algebra sig m => Algebra (State s :+: sig) (StateT s m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (StateT s m) -> (State s :+: sig) n a -> ctx () -> StateT s m (ctx a) Source #

Algebra sig m => Algebra (State s :+: sig) (StateC s m) Source # 
Instance details

Defined in Control.Carrier.State.Strict

Methods

alg :: Functor ctx => Handler ctx n (StateC s m) -> (State s :+: sig) n a -> ctx () -> StateC s m (ctx a) Source #

Algebra sig m => Algebra (State s :+: sig) (StateC s m) Source # 
Instance details

Defined in Control.Carrier.State.Lazy

Methods

alg :: Functor ctx => Handler ctx n (StateC s m) -> (State s :+: sig) n a -> ctx () -> StateC s m (ctx a) Source #

Algebra sig m => Algebra (State s :+: sig) (StateC s m) Source # 
Instance details

Defined in Control.Carrier.State.Church

Methods

alg :: Functor ctx => Handler ctx n (StateC s m) -> (State s :+: sig) n a -> ctx () -> StateC s m (ctx a) Source #

Algebra sig m => Algebra (Throw e :+: sig) (ThrowC e m) Source # 
Instance details

Defined in Control.Carrier.Throw.Either

Methods

alg :: Functor ctx => Handler ctx n (ThrowC e m) -> (Throw e :+: sig) n a -> ctx () -> ThrowC e m (ctx a) Source #

Algebra sig m => Algebra (Error e :+: sig) (ExceptT e m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (ExceptT e m) -> (Error e :+: sig) n a -> ctx () -> ExceptT e m (ctx a) Source #

Algebra sig m => Algebra (Error e :+: sig) (ErrorC e m) Source # 
Instance details

Defined in Control.Carrier.Error.Either

Methods

alg :: Functor ctx => Handler ctx n (ErrorC e m) -> (Error e :+: sig) n a -> ctx () -> ErrorC e m (ctx a) Source #

Algebra sig m => Algebra (Error e :+: sig) (ErrorC e m) Source # 
Instance details

Defined in Control.Carrier.Error.Church

Methods

alg :: Functor ctx => Handler ctx n (ErrorC e m) -> (Error e :+: sig) n a -> ctx () -> ErrorC e m (ctx a) Source #

(Algebra sig m, Monoid w) => Algebra (Writer w :+: sig) (WriterT w m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (WriterT w m) -> (Writer w :+: sig) n a -> ctx () -> WriterT w m (ctx a) Source #

(Algebra sig m, Monoid w) => Algebra (Writer w :+: sig) (WriterT w m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (WriterT w m) -> (Writer w :+: sig) n a -> ctx () -> WriterT w m (ctx a) Source #

(Monoid w, Algebra sig m) => Algebra (Writer w :+: sig) (WriterC w m) Source # 
Instance details

Defined in Control.Carrier.Writer.Strict

Methods

alg :: Functor ctx => Handler ctx n (WriterC w m) -> (Writer w :+: sig) n a -> ctx () -> WriterC w m (ctx a) Source #

(Algebra sig m, Monoid w) => Algebra (Writer w :+: sig) (WriterC w m) Source # 
Instance details

Defined in Control.Carrier.Writer.Church

Methods

alg :: Functor ctx => Handler ctx n (WriterC w m) -> (Writer w :+: sig) n a -> ctx () -> WriterC w m (ctx a) Source #

(Reifies s (Interpreter eff m), Algebra sig m) => Algebra (eff :+: sig) (InterpretC s eff m) Source # 
Instance details

Defined in Control.Carrier.Interpret

Methods

alg :: Functor ctx => Handler ctx n (InterpretC s eff m) -> (eff :+: sig) n a -> ctx () -> InterpretC s eff m (ctx a) Source #

Algebra sig m => Algebra (Reader r :+: sig) (ReaderT r m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (ReaderT r m) -> (Reader r :+: sig) n a -> ctx () -> ReaderT r m (ctx a) Source #

(LabelledMember label sub sig, Algebra sig m) => Algebra (sub :+: sig) (UnderLabel label sub m) Source # 
Instance details

Defined in Control.Effect.Labelled

Methods

alg :: Functor ctx => Handler ctx n (UnderLabel label sub m) -> (sub :+: sig) n a -> ctx () -> UnderLabel label sub m (ctx a) Source #

(Algebra sig m, Monoid w) => Algebra (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (RWST r w s m) -> (Reader r :+: (Writer w :+: (State s :+: sig))) n a -> ctx () -> RWST r w s m (ctx a) Source #

(Algebra sig m, Monoid w) => Algebra (Reader r :+: (Writer w :+: (State s :+: sig))) (RWST r w s m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: Functor ctx => Handler ctx n (RWST r w s m) -> (Reader r :+: (Writer w :+: (State s :+: sig))) n a -> ctx () -> RWST r w s m (ctx a) Source #

Algebra (eff :+: sig) (sub m) => Algebra (Labelled label eff :+: sig) (Labelled label sub m) Source # 
Instance details

Defined in Control.Effect.Labelled

Methods

alg :: Functor ctx => Handler ctx n (Labelled label sub m) -> (Labelled label eff :+: sig) n a -> ctx () -> Labelled label sub m (ctx a) Source #

(Functor (f m), Functor (g m)) => Functor ((f :+: g) m) Source # 
Instance details

Defined in Control.Effect.Sum

Methods

fmap :: (a -> b) -> (f :+: g) m a -> (f :+: g) m b #

(<$) :: a -> (f :+: g) m b -> (f :+: g) m a #

(Foldable (f m), Foldable (g m)) => Foldable ((f :+: g) m) Source # 
Instance details

Defined in Control.Effect.Sum

Methods

fold :: Monoid m0 => (f :+: g) m m0 -> m0 #

foldMap :: Monoid m0 => (a -> m0) -> (f :+: g) m a -> m0 #

foldr :: (a -> b -> b) -> b -> (f :+: g) m a -> b #

foldr' :: (a -> b -> b) -> b -> (f :+: g) m a -> b #

foldl :: (b -> a -> b) -> b -> (f :+: g) m a -> b #

foldl' :: (b -> a -> b) -> b -> (f :+: g) m a -> b #

foldr1 :: (a -> a -> a) -> (f :+: g) m a -> a #

foldl1 :: (a -> a -> a) -> (f :+: g) m a -> a #

toList :: (f :+: g) m a -> [a] #

null :: (f :+: g) m a -> Bool #

length :: (f :+: g) m a -> Int #

elem :: Eq a => a -> (f :+: g) m a -> Bool #

maximum :: Ord a => (f :+: g) m a -> a #

minimum :: Ord a => (f :+: g) m a -> a #

sum :: Num a => (f :+: g) m a -> a #

product :: Num a => (f :+: g) m a -> a #

(Traversable (f m), Traversable (g m)) => Traversable ((f :+: g) m) Source # 
Instance details

Defined in Control.Effect.Sum

Methods

traverse :: Applicative f0 => (a -> f0 b) -> (f :+: g) m a -> f0 ((f :+: g) m b) #

sequenceA :: Applicative f0 => (f :+: g) m (f0 a) -> f0 ((f :+: g) m a) #

mapM :: Monad m0 => (a -> m0 b) -> (f :+: g) m a -> m0 ((f :+: g) m b) #

sequence :: Monad m0 => (f :+: g) m (m0 a) -> m0 ((f :+: g) m a) #

(Eq (f m k), Eq (g m k)) => Eq ((f :+: g) m k) Source # 
Instance details

Defined in Control.Effect.Sum

Methods

(==) :: (f :+: g) m k -> (f :+: g) m k -> Bool #

(/=) :: (f :+: g) m k -> (f :+: g) m k -> Bool #

(Ord (f m k), Ord (g m k)) => Ord ((f :+: g) m k) Source # 
Instance details

Defined in Control.Effect.Sum

Methods

compare :: (f :+: g) m k -> (f :+: g) m k -> Ordering #

(<) :: (f :+: g) m k -> (f :+: g) m k -> Bool #

(<=) :: (f :+: g) m k -> (f :+: g) m k -> Bool #

(>) :: (f :+: g) m k -> (f :+: g) m k -> Bool #

(>=) :: (f :+: g) m k -> (f :+: g) m k -> Bool #

max :: (f :+: g) m k -> (f :+: g) m k -> (f :+: g) m k #

min :: (f :+: g) m k -> (f :+: g) m k -> (f :+: g) m k #

(Show (f m k), Show (g m k)) => Show ((f :+: g) m k) Source # 
Instance details

Defined in Control.Effect.Sum

Methods

showsPrec :: Int -> (f :+: g) m k -> ShowS #

show :: (f :+: g) m k -> String #

showList :: [(f :+: g) m k] -> ShowS #