heftia-0.6.0.1: higher-order algebraic effects done right
Copyright(c) 2016 Allele Dev; 2017 Ixperta Solutions s.r.o.; 2017 Alexis King; 2024 Sayo contributors
LicenseMPL-2.0 AND BSD-3-Clause (see the LICENSE and LICENSE.BSD3 files)
Maintainerymdfield@outlook.jp
Safe HaskellSafe-Inferred
LanguageGHC2021

Control.Monad.Hefty.Interpret.State

Description

This module provides an ad-hoc specialized version of Control.Monad.Hefty.Interpret to accelerate interpretations that have a single state type s, especially for effects like State or Writer.

Synopsis

Documentation

type StateHandler s e m n (ans :: Type) = forall x. e m x -> s -> (s -> x -> n ans) -> n ans Source #

An ad-hoc stateful version of Handler for performance.

Interpretation functions

interpretStateBy :: forall s e es ans a. (KnownOrder e, FOEs es) => s -> (s -> a -> Eff es ans) -> StateHandler s e (Eff (e ': es)) (Eff es) ans -> Eff (e ': es) a -> Eff es ans Source #

reinterpretStateBy :: forall s e es' es ans a. (Suffix es es', KnownOrder e, FOEs es) => s -> (s -> a -> Eff es' ans) -> StateHandler s e (Eff (e ': es)) (Eff es') ans -> Eff (e ': es) a -> Eff es' ans Source #

Interposition functions

interposeStateBy :: forall s e es ans a. (e :> es, FOEs es) => s -> (s -> a -> Eff es ans) -> StateHandler s e (Eff es) (Eff es) ans -> Eff es a -> Eff es ans Source #

interposeStateInBy :: forall s e es ans a. (e `In` es, FOEs es) => s -> (s -> a -> Eff es ans) -> StateHandler s e (Eff es) (Eff es) ans -> Eff es a -> Eff es ans Source #

interposeStateForBy :: forall s e es ans a. (KnownOrder e, FOEs es) => Membership e es -> s -> (s -> a -> Eff es ans) -> StateHandler s e (Eff es) (Eff es) ans -> Eff es a -> Eff es ans Source #