[Haskell-beginners] functional parser type error

Stephen Tetley stephen.tetley at gmail.com
Thu Apr 5 08:25:58 CEST 2012


There is working code to accompany the book on Graham Hutton's website
that wraps Parser as a newtype.

http://www.cs.nott.ac.uk/~gmh/book.html
http://www.cs.nott.ac.uk/~gmh/Parsing.lhs

Graham makes a brief comment about the difference at the end of the
parsing chapter.

On 4 April 2012 18:31, Brent Yorgey <byorgey at seas.upenn.edu> wrote:

> In order to use do-notation, Parser has to be an instance of Monad.
> However, ((->) String) is already an instance of Monad, and it's not
> the instance you want for Parser.  There cannot be two instances for
> the same type, so you must wrap it in a newtype in order to make a
> different instance.



More information about the Beginners mailing list