Data.Accessor.Monad.Trans.RWS

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.RWS

Contents

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

Description

Access helper functions in a Reader-Writer-State monad

Synopsis

- set :: (Monad m, Monoid w) => T s a -> a -> RWST r w s m ()
- get :: (Monad m, Monoid w) => T s a -> RWST r w s m a
- modify :: (Monad m, Monoid w) => T s a -> (a -> a) -> RWST r w s m ()
- getAndModify :: (Monad m, Monoid w) => T s a -> (a -> a) -> RWST r w s m a
- modifyAndGet :: (Monad m, Monoid w) => T s a -> (a -> a) -> RWST r w s m a
- (%=) :: (Monad m, Monoid w) => T s a -> a -> RWST r w s m ()
- (%:) :: (Monad m, Monoid w) => T s a -> (a -> a) -> RWST r w s m ()
- lift :: (Monad m, Monoid w) => T s1 s0 -> RWS r w s0 a -> RWST r w s1 m a
- liftT :: (Monad m, Monoid w) => T s1 s0 -> RWST r w s0 m a -> RWST r w s1 m a

# accessors in the form of actions in the RWS monad

set :: (Monad m, Monoid w) => T s a -> a -> RWST r w s m ()

get :: (Monad m, Monoid w) => T s a -> RWST r w s m a

modify :: (Monad m, Monoid w) => T s a -> (a -> a) -> RWST r w s m ()

getAndModify :: (Monad m, Monoid w) => T s a -> (a -> a) -> RWST r w s m a

Modify a record element and return its old value.

modifyAndGet :: (Monad m, Monoid w) => T s a -> (a -> a) -> RWST r w s m a

Modify a record element and return its new value.

(%=) :: (Monad m, Monoid w) => T s a -> a -> RWST r w s m () infix 1

Infix variant of `set`.

(%:) :: (Monad m, Monoid w) => T s a -> (a -> a) -> RWST r w s m () infix 1

Infix variant of `modify`.

# lift a RWS monadic accessor to an accessor of a parent record

lift :: (Monad m, Monoid w) => T s1 s0 -> RWS r w s0 a -> RWST r w s1 m a

liftT :: (Monad m, Monoid w) => T s1 s0 -> RWST r w s0 m a -> RWST r w s1 m a