heftia-effects-0.5.0.0: higher-order algebraic effects done right
Copyright(c) 2023 Sayo Koyoneda
LicenseMPL-2.0 (see the LICENSE file)
Maintainer[email protected]
Safe HaskellNone
LanguageGHC2021

Control.Monad.Hefty.Writer

Description

Interpreters for the Writer effects.

Synopsis

Documentation

runWriterPost :: forall w (ef :: [Type -> Type]) a. Monoid w => Eff '[WriterH w] (Tell w ': ef) a -> Eff ('[] :: [EffectH]) ef (w, a) Source #

Interpret the Writer effects with post-applying censor semantics.

handleTell :: forall w (ef :: [EffectF]) a. Monoid w => StateInterpreter w (Tell w) (Eff ('[] :: [EffectH]) ef) (w, a) Source #

A handler function for the Tell effect.

runTell :: forall w (ef :: [Type -> Type]) a. Monoid w => Eff ('[] :: [EffectH]) (Tell w ': ef) a -> Eff ('[] :: [EffectH]) ef (w, a) Source #

Interpret the Tell effect.

runWriterHPost :: forall w (ef :: [EffectF]). (Monoid w, Tell w <| ef) => Eff '[WriterH w] ef ~> Eff ('[] :: [EffectH]) ef Source #

Interpret the WriterH effect with post-applying censor semantics.

runWriterPre :: forall w (ef :: [Type -> Type]) a. Monoid w => Eff '[WriterH w] (Tell w ': ef) a -> Eff ('[] :: [EffectH]) ef (w, a) Source #

Interpret the Writer effects with pre-applying censor semantics.

runWriterHPre :: forall w (ef :: [EffectF]). (Monoid w, Tell w <| ef) => Eff '[WriterH w] ef ~> Eff ('[] :: [EffectH]) ef Source #

Interpret the WriterH effect with pre-applying censor semantics.

intercept :: forall w (ef :: [EffectF]) a. (Tell w <| ef, Monoid w) => Eff ('[] :: [EffectH]) ef a -> Eff ('[] :: [EffectH]) ef (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 (ef :: [EffectF]). (Tell w <| ef, Monoid w) => (w -> w) -> Eff ('[] :: [EffectH]) ef ~> Eff ('[] :: [EffectH]) ef Source #

censor with post-applying semantics.

censorPre :: forall w (eh :: [EffectH]) (ef :: [EffectF]). (Tell w <| ef, Monoid w) => (w -> w) -> Eff eh ef ~> Eff eh ef Source #

censor with pre-applying semantics.

confiscate :: forall w (ef :: [EffectF]) a. (Tell w <| ef, Monoid w) => Eff ('[] :: [EffectH]) ef a -> Eff ('[] :: [EffectH]) ef (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.