rewire-user-2.8
Safe HaskellNone
LanguageHaskell2010

ReWire.Monad

Description

This module defines operations related to monads in ReWire, including functions for defining looping monadic actions, and simplifying a tower of monad transformers down to the simple ReacT action required by rwc. It provides type synonyms for distinguishing looping devices and stateful devices that run indefinitely.

Synopsis

Documentation

iter :: (i -> o) -> i -> ReacT i o Identity () Source #

iterSt :: (i -> s -> (o, s)) -> i -> ReacT i o (StateT s Identity) () Source #

extrudeDev :: StateDev i o (StateT s Identity) -> s -> Dev i o Source #

Extrude a stateful device to remove the final StateT monad transformer.

extrudeStateDev :: forall (m :: Type -> Type) i o s. Monad m => StateDev i o (StateT s m) -> s -> StateDev i o m Source #

Extrude a stateful device to reduce the monad transformer tower.

type Dev i o = ReacT i o Identity () Source #

Should be used to represent a looping device that operates indefinitely. Formally, distinguishes a Re_+ device from an Re_INF device for embedding.

type StateDev i o (m :: Type -> Type) = ReacT i o m () Source #

Similar to Dev, but for stateful computations.