data-accessor-transformers-0.2.1.7: Use Accessor to access state in transformers State monad

Safe Haskell | Safe
Language | Haskell98

Data.Accessor.Monad.Trans.State

Contents

- accessors in the form of actions in the state monad
- lift a state monadic accessor to an accessor of a parent record

Description

Access helper functions in a State monad

Synopsis

- set :: Monad m => T r a -> a -> StateT r m ()
- get :: Monad m => T r a -> StateT r m a
- modify :: Monad m => T r a -> (a -> a) -> StateT r m ()
- getAndModify :: Monad m => T r a -> (a -> a) -> StateT r m a
- modifyAndGet :: Monad m => T r a -> (a -> a) -> StateT r m a
- (%=) :: Monad m => T r a -> a -> StateT r m ()
- (%:) :: Monad m => T r a -> (a -> a) -> StateT r m ()
- lift :: Monad m => T r s -> State s a -> StateT r m a
- liftT :: Monad m => T r s -> StateT s m a -> StateT r m a

# accessors in the form of actions in the state monad

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

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

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

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

Modify a record element and return its old value.

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

Modify a record element and return its new value.

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

Infix variant of `set`.

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

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 #

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