haskellmonad-transformers

Describing my Parser type as a series of monad transformers


I have to describe the Parser type as a series of monad transformers. As far as I understand, monad transformers are used to wrap monads into another monad. But I don't understand what is the task here.


Solution

  • Instead of defining a new type for Parser, you can simply define it as a type alias for a type created by one or more monad transformers. That is, you definition would look something like

    type Parser a = SomeMonadT <some set of monads and types>
    

    Your task, then, is to determine which monad transformer(s) to use, and what the arguments to the transformer(s) should be.