fused-effects-1.1.2.3: A fast, flexible, fused effect system.
Safe HaskellNone
LanguageHaskell2010

Control.Effect.Choose

Description

An effect modelling nondeterminism without failure (one or more successful results).

The NonDet effect is the composition of Choose and Empty.

Predefined carriers:

Since: 1.0.0.0

Synopsis

Choose effect

data Choose (m :: Type -> Type) k where Source #

Since: 1.0.0.0

Constructors

Choose :: forall (m :: Type -> Type). Choose m Bool 

Instances

Instances details
Algebra Choose NonEmpty Source # 
Instance details

Defined in Control.Algebra

Methods

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

Algebra NonDet [] Source # 
Instance details

Defined in Control.Algebra

Methods

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

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

Defined in Control.Carrier.Choose.Church

Methods

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

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

Defined in Control.Carrier.Cull.Church

Methods

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

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

Defined in Control.Carrier.Cut.Church

Methods

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

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

Defined in Control.Carrier.NonDet.Church

Methods

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

(<|>) :: forall (sig :: (Type -> Type) -> Type -> Type) m a. Has Choose sig m => m a -> m a -> m a infixl 3 Source #

Nondeterministically choose between two computations.

(m <|> n) >>= k = (m >>= k) <|> (n >>= k)
(m <|> n) <|> o = m <|> (n <|> o)
empty <|> m = m
m <|> empty = m

Since: 1.0.0.0

optional :: forall (sig :: (Type -> Type) -> Type -> Type) m a. Has Choose sig m => m a -> m (Maybe a) Source #

Select between Just the result of an operation, and Nothing.

optional empty = pure Nothing
optional (pure a) = pure (Just a)

Since: 1.0.0.0

many :: forall (sig :: (Type -> Type) -> Type -> Type) m a. Has Choose sig m => m a -> m [a] Source #

Zero or more.

many m = some m <|> pure []

Since: 1.0.0.0

some :: forall (sig :: (Type -> Type) -> Type -> Type) m a. Has Choose sig m => m a -> m [a] Source #

One or more.

some m = (:) <$> m <*> many m

Since: 1.0.0.0

some1 :: forall (sig :: (Type -> Type) -> Type -> Type) m a. Has Choose sig m => m a -> m (NonEmpty a) Source #

One or more, returning a NonEmpty list of the results.

some1 m = (:|) <$> m <*> many m

Since: 1.0.0.0

Choosing semigroup

newtype Choosing (m :: Type -> Type) a Source #

Since: 1.0.0.0

Constructors

Choosing 

Fields

Instances

Instances details
MonadTrans Choosing Source # 
Instance details

Defined in Control.Effect.Choose

Methods

lift :: Monad m => m a -> Choosing m a #

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

Defined in Control.Effect.Choose

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (Choosing m) -> sig n a -> ctx () -> Choosing m (ctx a) Source #

MonadIO m => MonadIO (Choosing m) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

liftIO :: IO a -> Choosing m a #

MonadZip m => MonadZip (Choosing m) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

mzip :: Choosing m a -> Choosing m b -> Choosing m (a, b) #

mzipWith :: (a -> b -> c) -> Choosing m a -> Choosing m b -> Choosing m c #

munzip :: Choosing m (a, b) -> (Choosing m a, Choosing m b) #

(Has Choose sig m, Has Empty sig m) => Alternative (Choosing m) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

empty :: Choosing m a #

(<|>) :: Choosing m a -> Choosing m a -> Choosing m a #

some :: Choosing m a -> Choosing m [a] #

many :: Choosing m a -> Choosing m [a] #

Applicative m => Applicative (Choosing m) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

pure :: a -> Choosing m a #

(<*>) :: Choosing m (a -> b) -> Choosing m a -> Choosing m b #

liftA2 :: (a -> b -> c) -> Choosing m a -> Choosing m b -> Choosing m c #

(*>) :: Choosing m a -> Choosing m b -> Choosing m b #

(<*) :: Choosing m a -> Choosing m b -> Choosing m a #

Functor m => Functor (Choosing m) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

fmap :: (a -> b) -> Choosing m a -> Choosing m b #

(<$) :: a -> Choosing m b -> Choosing m a #

Monad m => Monad (Choosing m) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

(>>=) :: Choosing m a -> (a -> Choosing m b) -> Choosing m b #

(>>) :: Choosing m a -> Choosing m b -> Choosing m b #

return :: a -> Choosing m a #

(Has Choose sig m, Has Empty sig m) => MonadPlus (Choosing m) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

mzero :: Choosing m a #

mplus :: Choosing m a -> Choosing m a -> Choosing m a #

MonadFail m => MonadFail (Choosing m) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

fail :: String -> Choosing m a #

MonadFix m => MonadFix (Choosing m) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

mfix :: (a -> Choosing m a) -> Choosing m a #

Foldable m => Foldable (Choosing m) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

fold :: Monoid m0 => Choosing m m0 -> m0 #

foldMap :: Monoid m0 => (a -> m0) -> Choosing m a -> m0 #

foldMap' :: Monoid m0 => (a -> m0) -> Choosing m a -> m0 #

foldr :: (a -> b -> b) -> b -> Choosing m a -> b #

foldr' :: (a -> b -> b) -> b -> Choosing m a -> b #

foldl :: (b -> a -> b) -> b -> Choosing m a -> b #

foldl' :: (b -> a -> b) -> b -> Choosing m a -> b #

foldr1 :: (a -> a -> a) -> Choosing m a -> a #

foldl1 :: (a -> a -> a) -> Choosing m a -> a #

toList :: Choosing m a -> [a] #

null :: Choosing m a -> Bool #

length :: Choosing m a -> Int #

elem :: Eq a => a -> Choosing m a -> Bool #

maximum :: Ord a => Choosing m a -> a #

minimum :: Ord a => Choosing m a -> a #

sum :: Num a => Choosing m a -> a #

product :: Num a => Choosing m a -> a #

Traversable m => Traversable (Choosing m) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

traverse :: Applicative f => (a -> f b) -> Choosing m a -> f (Choosing m b) #

sequenceA :: Applicative f => Choosing m (f a) -> f (Choosing m a) #

mapM :: Monad m0 => (a -> m0 b) -> Choosing m a -> m0 (Choosing m b) #

sequence :: Monad m0 => Choosing m (m0 a) -> m0 (Choosing m a) #

MonadUnliftIO m => MonadUnliftIO (Choosing m) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

withRunInIO :: ((forall a. Choosing m a -> IO a) -> IO b) -> Choosing m b #

(Has Choose sig m, Has Empty sig m) => Monoid (Choosing m a) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

mempty :: Choosing m a #

mappend :: Choosing m a -> Choosing m a -> Choosing m a #

mconcat :: [Choosing m a] -> Choosing m a #

Has Choose sig m => Semigroup (Choosing m a) Source # 
Instance details

Defined in Control.Effect.Choose

Methods

(<>) :: Choosing m a -> Choosing m a -> Choosing m a #

sconcat :: NonEmpty (Choosing m a) -> Choosing m a #

stimes :: Integral b => b -> Choosing m a -> Choosing m a #

Re-exports

class Monad m => Algebra (sig :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) | m -> sig 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

Minimal complete definition

alg

Instances

Instances details
Algebra Choose NonEmpty Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: forall ctx (n :: Type -> Type) a. 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 :: forall ctx (n :: Type -> Type) a. 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 :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n [] -> NonDet n a -> ctx () -> [ctx a] Source #

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

Defined in Control.Effect.Choose

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (Choosing m) -> sig n a -> ctx () -> Choosing 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 :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (Ap m) -> sig n a -> ctx () -> Ap m (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 :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (Alt m) -> sig n a -> ctx () -> Alt m (ctx a) Source #

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

Defined in Control.Algebra

Methods

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

Algebra (Lift Identity) Identity Source # 
Instance details

Defined in Control.Algebra

Methods

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

Algebra (Lift IO) IO Source # 
Instance details

Defined in Control.Algebra

Methods

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

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

Defined in Control.Algebra

Methods

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

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

Defined in Control.Carrier.Lift

Methods

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

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

Defined in Control.Algebra

Methods

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

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

Defined in Control.Algebra

Methods

alg :: forall ctx (n :: Type -> Type) a. 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 :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (ChooseC m) -> (Choose :+: sig) n a -> ctx () -> ChooseC m (ctx a) Source #

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

Defined in Control.Carrier.Cull.Church

Methods

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

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

Defined in Control.Carrier.Cut.Church

Methods

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

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

Defined in Control.Carrier.Empty.Church

Methods

alg :: forall ctx (n :: Type -> Type) a. 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.Maybe

Methods

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

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

Defined in Control.Algebra

Methods

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

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

Defined in Control.Carrier.Fail.Either

Methods

alg :: forall ctx (n :: Type -> Type) a. 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.Church

Methods

alg :: forall ctx (n :: Type -> Type) a. 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.Strict

Methods

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

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

Defined in Control.Carrier.NonDet.Church

Methods

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

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

Defined in Control.Carrier.Trace.Ignoring

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (TraceC m) -> (Trace :+: sig) n a -> ctx () -> TraceC 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 :: forall ctx (n :: Type -> Type) a. 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 :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (TraceC m) -> (Trace :+: sig) n a -> ctx () -> TraceC m (ctx a) Source #

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

Defined in Control.Carrier.Accum.Church

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (AccumC w m) -> (Accum w :+: sig) n a -> ctx () -> AccumC w m (ctx a) Source #

(Algebra sig m, Semigroup w, MonadIO m) => Algebra (Accum w :+: sig) (AccumC w m) Source # 
Instance details

Defined in Control.Carrier.Accum.IORef

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (AccumC w m) -> (Accum w :+: sig) n a -> ctx () -> AccumC w m (ctx a) Source #

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

Defined in Control.Carrier.Accum.Strict

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (AccumC w m) -> (Accum w :+: sig) n a -> ctx () -> AccumC w m (ctx a) Source #

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

Defined in Control.Algebra

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (AccumT w m) -> (Accum w :+: sig) n a -> ctx () -> AccumT w 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 :: forall ctx (n :: Type -> Type) a. 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.Either

Methods

alg :: forall ctx (n :: Type -> Type) a. 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) (ExceptT e m) Source # 
Instance details

Defined in Control.Algebra

Methods

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

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

Defined in Control.Carrier.Reader

Methods

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

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

Defined in Control.Algebra

Methods

alg :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (ReaderT r m) -> (Reader r :+: sig) n a -> ctx () -> ReaderT r 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 :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (StateC s m) -> (State s :+: sig) n a -> ctx () -> StateC s m (ctx a) Source #

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

Defined in Control.Carrier.State.IORef

Methods

alg :: forall ctx (n :: Type -> Type) a. 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 :: forall ctx (n :: Type -> Type) a. 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.Strict

Methods

alg :: forall ctx (n :: Type -> Type) a. 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) (StateT s m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: forall ctx (n :: Type -> Type) a. 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 :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (StateT s m) -> (State s :+: sig) n a -> ctx () -> StateT 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 :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (ThrowC e m) -> (Throw e :+: sig) n a -> ctx () -> ThrowC e 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 :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (WriterC w m) -> (Writer w :+: sig) n a -> ctx () -> WriterC 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 :: forall ctx (n :: Type -> Type) a. 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) (WriterT w m) Source # 
Instance details

Defined in Control.Algebra

Methods

alg :: forall ctx (n :: Type -> Type) a. 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 :: forall ctx (n :: Type -> Type) a. 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 :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (WriterT w m) -> (Writer w :+: sig) n a -> ctx () -> WriterT 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 :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (InterpretC s eff m) -> (eff :+: sig) n a -> ctx () -> InterpretC s eff 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 :: forall ctx (n :: Type -> Type) a. Functor ctx => Handler ctx n (Labelled label sub m) -> (Labelled label eff :+: sig) n a -> ctx () -> Labelled 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 :: forall ctx (n :: Type -> Type) a. 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 :: forall ctx (n :: Type -> Type) a. 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 :: forall ctx (n :: Type -> Type) a. 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 #

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

Defined in Control.Effect.Labelled

Methods

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

type Has (eff :: (Type -> Type) -> Type -> Type) (sig :: (Type -> Type) -> Type -> Type) (m :: Type -> Type) = (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

run :: Identity a -> a Source #

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

Since: 1.0.0.0