data-accessor-monads-tf-0.2.1.3: Use Accessor to access state in monads-tf State monad type family

Data.Accessor.Monad.TF.State

Contents

Description

Access helper functions in the State monad type family

Synopsis

accessors in the form of actions in the state monad

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

get :: MonadState m => T (StateType m) a -> m aSource

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

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

Modify a record element and return its old value.

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

Modify a record element and return its new value.

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

Infix variant of set.

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

Infix variant of modify.

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

lift :: MonadState mr => T (StateType mr) s -> State s a -> mr aSource

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