data-accessor-mtl-0.2.0.1: Use Accessor to access state in mtl State monad class

Data.Accessor.Monad.MTL.State

Contents

Description

Access helper functions in the State monad class

Synopsis

accessors in the form of actions in the state monad

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

get :: MonadState r m => T r a -> m aSource

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

getAndModify :: MonadState r m => T r a -> (a -> a) -> m aSource

Modify a record element and return its old value.

modifyAndGet :: MonadState r m => T r a -> (a -> a) -> m aSource

Modify a record element and return its new value.

(%=) :: MonadState r m => T r a -> a -> m ()Source

Infix variant of set.

(%:) :: MonadState r m => T r a -> (a -> a) -> m ()Source

Infix variant of modify.

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

lift :: MonadState r mr => T r s -> State s a -> mr aSource

liftT :: (Monad m, MonadTrans t, MonadState r (t m)) => T r s -> StateT s m a -> t m aSource