heftia-effects-0.7.0.0: higher-order algebraic effects done right
Copyright(c) 2023 Sayo contributors
LicenseMPL-2.0 (see the LICENSE file)
Maintainerymdfield@outlook.jp
Safe HaskellNone
LanguageGHC2021

Control.Monad.Hefty.Writer

Description

Interpreters for the Writer effects.

Synopsis

Documentation

runWriterPost :: forall w (es :: [Effect]) a. (Monoid w, FOEs es) => Eff (WriterH w ': (Tell w ': es)) a -> Eff es (w, a) Source #

Interpret the Writer effects with post-applying censor semantics.

handleTell :: forall w (f :: Type -> Type) (g :: Type -> Type) a. Monoid w => StateHandler w (Tell w) f g (w, a) Source #

A handler function for the Tell effect.

runTell :: forall w (es :: [Effect]) a. (Monoid w, FOEs es) => Eff (Tell w ': es) a -> Eff es (w, a) Source #

Interpret the Tell effect.

runWriterHPost :: forall w (es :: [Effect]) a. (Monoid w, In (Tell w) es, FOEs es) => Eff (WriterH w ': es) a -> Eff es a Source #

Interpret the WriterH effect with post-applying censor semantics.

runWriterPre :: forall w (es :: [Effect]) a. (Monoid w, FOEs es) => Eff (WriterH w ': (Tell w ': es)) a -> Eff es (w, a) Source #

Interpret the Writer effects with pre-applying censor semantics.

runWriterHPre :: forall w (es :: [Effect]) a. (Monoid w, In (Tell w) es, FOEs es) => Eff (WriterH w ': es) a -> Eff es a Source #

Interpret the WriterH effect with pre-applying censor semantics.

intercept :: forall w (es :: [Effect]) a. (In (Tell w) es, Monoid w, FOEs es) => Eff es a -> Eff es (w, a) Source #

Retrieves the monoidal value accumulated by tell within the given action. The tell effect is not consumed and remains intact.

censorPost :: forall w a (es :: [Effect]). (In (Tell w) es, Monoid w, FOEs es) => (w -> w) -> Eff es a -> Eff es a Source #

censor with post-applying semantics.

confiscate :: forall w (es :: [Effect]) a. (In (Tell w) es, Monoid w, FOEs es) => Eff es a -> Eff es (w, a) Source #

Consumes all the tell effects from the specified Tell w slot within the given action and returns the accumulated monoidal value along with the result.