Answers
Here are the answers to this chapter’s questions:
- A monad transformer is a type constructor,
T
, that transforms any monad,M
, into a new monad,T M
. Moreover,T
must be an instance of theMonadTrans
type class:class MonadTrans t where lift :: Monad m => m a -> t m a
Monad transformers are typically used to augment existing monad with the functionality of an additional effect.
- The important monad transformers are:
Effect |
Monad Transformer |
Key Operations |
Reader/environment |
|
|
Writer |
|
|
State |
|
|