data-accessor-0.2.2.7: Utilities for accessing and manipulating fields of records

Safe HaskellSafe
LanguageHaskell98

Data.Accessor.MonadState

Contents

Description

Deprecated: please use Data.Accessor.Monad.Trans.State from data-accessor-transformers

Access helper functions in a State monad

Synopsis

accessors in the form of actions in the state monad

set :: Monad m => T r a -> a -> StateT r m () Source

get :: Monad m => T r a -> StateT r m a Source

modify :: Monad m => T r a -> (a -> a) -> StateT r m () Source

getAndModify :: Monad m => T r a -> (a -> a) -> StateT r m a Source

Modify a record element and return its old value.

modifyAndGet :: Monad m => T r a -> (a -> a) -> StateT r m a Source

Modify a record element and return its new value.

(%=) :: Monad m => T r a -> a -> StateT r m () infix 1 Source

Infix variant of set.

(%:) :: Monad m => T r a -> (a -> a) -> StateT r m () infix 1 Source

Infix variant of modify.

lift a state monadic accessor to an accessor of a parent record

lift :: Monad m => T r s -> State s a -> StateT r m a Source

liftT :: Monad m => T r s -> StateT s m a -> StateT r m a Source