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.State

Description

Interpreter for the State effect.

Synopsis

Documentation

runState :: forall s (ef :: [Type -> Type]) a. s -> Eff ('[] :: [EffectH]) (State s ': ef) a -> Eff ('[] :: [EffectH]) ef (s, a) Source #

Interpret the Get/Put effects.

evalState :: forall s (ef :: [Type -> Type]) a. s -> Eff ('[] :: [EffectH]) (State s ': ef) a -> Eff ('[] :: [EffectH]) ef a Source #

execState :: forall s (ef :: [Type -> Type]) a. s -> Eff ('[] :: [EffectH]) (State s ': ef) a -> Eff ('[] :: [EffectH]) ef s Source #

runStateRec :: forall s (ef :: [Type -> Type]) (eh :: [EffectH]). s -> Eff eh (State s ': ef) ~> Eff eh ef Source #

handleState :: forall s (eh :: [EffectH]) (r :: [EffectF]) ans x. State s x -> s -> (s -> x -> Eff eh r ans) -> Eff eh r ans Source #

runStateIORef :: forall s (ef :: [EffectF]) (eh :: [EffectH]) a. IO <| ef => s -> Eff eh (State s ': ef) a -> Eff eh ef (s, a) Source #

transactState :: forall s (ef :: [EffectF]). State s <| ef => Eff ('[] :: [EffectH]) ef ~> Eff ('[] :: [EffectH]) ef Source #

runStateNaive :: forall s (ef :: [Type -> Type]) a. s -> Eff ('[] :: [EffectH]) (State s ': ef) a -> Eff ('[] :: [EffectH]) ef (s, a) Source #

A naive but somewhat slower version of runState that does not use ad-hoc optimizations.

runStateNaiveRec :: forall s (ef :: [Type -> Type]) (eh :: [EffectH]). s -> Eff eh (State s ': ef) ~> Eff eh ef Source #

A naive but somewhat slower version of runStateRec that does not use ad-hoc optimizations.