changeset-0.1.0.2: Stateful monad transformer based on monoidal actions
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Monad.Changeset.Class

Description

A type class generalising the API of ChangesetT.

Synopsis

Documentation

class (Monad m, Monoid w, RightAction w s) => MonadChangeset s w m | m -> s, m -> w where Source #

Monads containing changeset state.

This usually implies that the ChangesetT monad transformer is part of the monad transformer stack of m. See its documentation for details.

Methods

changeset Source #

Arguments

:: (s -> (a, w))

Receives the current state and has to output a value and a change.

-> m a 

Apply a changeset to the state.

change :: w -> m () Source #

Apply a change to the state. The Action instance is used to mutate the state.

current :: m s Source #

Observe the current state.

Instances

Instances details
(Monad m, Monad (t m), MonadTrans t, MFunctor t, MonadChangeset s w m) => MonadChangeset s w (t m) Source # 
Instance details

Defined in Control.Monad.Changeset.Class

Methods

changeset :: (s -> (a, w)) -> t m a Source #

change :: w -> t m () Source #

current :: t m s Source #

(RightAction w s, Monoid w, Monad m) => MonadChangeset s w (ChangesetT s w m) Source # 
Instance details

Defined in Control.Monad.Trans.Changeset

Methods

changeset :: (s -> (a, w)) -> ChangesetT s w m a Source #

change :: w -> ChangesetT s w m () Source #

current :: ChangesetT s w m s Source #