post(typoclassopedia): Monad Transformers##DefinitionAndLaws

This commit is contained in:
Mahdi Dibaiee 2017-10-13 20:15:52 +03:30
parent 2a22aae326
commit 78c9fccc72

View File

@ -694,3 +694,23 @@ g >=> return = g
= (\x -> g x >>= h) >=> k = (\x -> g x >>= h) >=> k
= (g >=> h) >=> k = (g >=> h) >=> k
``` ```
Monad Transformers
==================
## Definition and laws
```haskell
class MonadTrans t where
lift :: Monad m => m a -> t m a
```
### Exercises
1. What is the kind of `t` in the declaration of `MonadTrans`?
**Solution**:
`t` is of the kind `(* -> *) -> * -> *`, as we see in `(t m) a`, `t` accepts a `Monad` first, which is of type `* -> *`, and then
another argument of kind `*`.