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

Control.Monad.Hefty.Writer

Description

Interpreters for the Writer effects.

Synopsis

Documentation

runWriterPost :: (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 :: Monoid w => StateHandler w (Tell w) f g (w, a) Source #

A handler function for the Tell effect.

runTell :: (Monoid w, FOEs es) => Eff (Tell w ': es) a -> Eff es (w, a) Source #

Interpret the Tell effect.

runWriterHPost :: (Monoid w, Tell w `In` es, FOEs es) => Eff (WriterH w ': es) a -> Eff es a Source #

Interpret the WriterH effect with post-applying censor semantics.

runWriterPre :: (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 :: (Monoid w, Tell w `In` 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 a. (Tell w `In` 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. (Tell w `In` es, Monoid w, FOEs es) => (w -> w) -> Eff es a -> Eff es a Source #

censor with post-applying semantics.

confiscate :: forall w es a. (Tell w `In` 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.