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

Control.Carrier.Accum.Church

Description

A high-performance, strict, church-encoded carrier for Accum.

This carrier issues left-associated mappends, meaning that Monoids such as [] with poor performance for left-associated mappends are ill-suited for use with this carrier. Alternatives such as Endo, Seq, or DList may be preferred.

Since: 1.1.2.0

Synopsis

Accum carrier

runAccum :: (w -> a -> m b) -> w -> AccumC w m a -> m b Source #

Run an Accum effect with a Monoidal log, applying a continuation to the final log and result.

runAccum k w0 (pure a) = k w0 a
runAccum k w0 (add w) = k (w0 <> w) ()
runAccum k w0 (add w >> look) = k (w0 <> w) (w0 <> w)

Since: 1.1.2.0

execAccum :: Applicative m => w -> AccumC w m a -> m w Source #

Run an Accum effect (typically with a Monoidal log), producing the final log and discarding the result value.

execAccum = runAccum (const . pure)

Since: 1.1.2.0

evalAccum :: Applicative m => w -> AccumC w m a -> m a Source #

Run an Accum effect (typically with a Monoidal log), producing the result value and discarding the final log.

evalAccum = runAccum (const . pure)

Since: 1.1.2.0

newtype AccumC w (m :: Type -> Type) a Source #

Since: 1.1.2.0

Constructors

AccumC (forall r. (w -> a -> m r) -> w -> m r) 

Instances

Instances details
Monoid w => MonadTrans (AccumC w) Source # 
Instance details

Defined in Control.Carrier.Accum.Church

Methods

lift :: Monad m => m a -> AccumC w m a #

(MonadIO m, Monoid w) => MonadIO (AccumC w m) Source # 
Instance details

Defined in Control.Carrier.Accum.Church

Methods

liftIO :: IO a -> AccumC w m a #

(Alternative m, Monad m, Monoid w) => Alternative (AccumC w m) Source # 
Instance details

Defined in Control.Carrier.Accum.Church

Methods

empty :: AccumC w m a #

(<|>) :: AccumC w m a -> AccumC w m a -> AccumC w m a #

some :: AccumC w m a -> AccumC w m [a] #

many :: AccumC w m a -> AccumC w m [a] #

Monoid w => Applicative (AccumC w m) Source # 
Instance details

Defined in Control.Carrier.Accum.Church

Methods

pure :: a -> AccumC w m a #

(<*>) :: AccumC w m (a -> b) -> AccumC w m a -> AccumC w m b #

liftA2 :: (a -> b -> c) -> AccumC w m a -> AccumC w m b -> AccumC w m c #

(*>) :: AccumC w m a -> AccumC w m b -> AccumC w m b #

(<*) :: AccumC w m a -> AccumC w m b -> AccumC w m a #

Functor (AccumC w m) Source # 
Instance details

Defined in Control.Carrier.Accum.Church

Methods

fmap :: (a -> b) -> AccumC w m a -> AccumC w m b #

(<$) :: a -> AccumC w m b -> AccumC w m a #

(Monad m, Monoid w) => Monad (AccumC w m) Source # 
Instance details

Defined in Control.Carrier.Accum.Church

Methods

(>>=) :: AccumC w m a -> (a -> AccumC w m b) -> AccumC w m b #

(>>) :: AccumC w m a -> AccumC w m b -> AccumC w m b #

return :: a -> AccumC w m a #

(MonadPlus m, Monoid w) => MonadPlus (AccumC w m) Source # 
Instance details

Defined in Control.Carrier.Accum.Church

Methods

mzero :: AccumC w m a #

mplus :: AccumC w m a -> AccumC w m a -> AccumC w m a #

(MonadFail m, Monoid w) => MonadFail (AccumC w m) Source # 
Instance details

Defined in Control.Carrier.Accum.Church

Methods

fail :: String -> AccumC w m a #

(MonadFix m, Monoid w) => MonadFix (AccumC w m) Source # 
Instance details

Defined in Control.Carrier.Accum.Church

Methods

mfix :: (a -> AccumC w m a) -> AccumC w m a #

(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 #

Accum effect