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

Control.Monad.Hefty.Writer

Description

Interpreter and elaborator for the Writer effect class. See README.md.

Synopsis

Documentation

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

Writer effect handler 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 #

Writer effect handler with pre-applying censor semantics.

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

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

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

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

listen :: 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.

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.

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

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