LoginSignup
2
2

More than 5 years have passed since last update.

Monad Transformer

Last updated at Posted at 2015-11-12

Example Usage of Monad Transformer

The best tutorial of Monad Transformer is "Monad Transformers Step by Step" by Martin Grabmulle. The tutorial is available online. Code is available here

Construct your own Monad Transformer

To better understand Monad Transformer, you can implement your own Monad Transformers. For example:

Problems of Monad Transformers:

One Monad Transformer shows up multiple times in the monad stack


-- Multiple Environments
type Eval a = ReaderT Env (ReaderT Env Identity) a

eval (Val n) = do env1 <- ask
                  env2 <- lift ask -- To get the inner environment, you need to lift the computation here
                  -- ...

Alternative to Monad Transformers

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2