data-accessor-monadLib-0.0.0: Accessor functions for monadLib's monads

Data.Accessor.MonadLib

Contents

Description

Access helper functions in State and Reader monads

Synopsis

accessors in the form of actions in the state monad

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

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

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

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

Modify a record element and return its old value.

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

Modify a record element and return its new value.

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

Infix variant of set.

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

Infix variant of modify.

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

lift :: StateM m r => T r s -> State s a -> m aSource

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

accessors in the form of actions in the reader monad

ask :: ReaderM m r => T r a -> m aSource

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

focusingOn :: ReaderM m r => T r s -> Reader s a -> m aSource

focusingOnT :: Monad m => T r s -> ReaderT s m a -> ReaderT r m aSource