[Haskell-cafe] newbie question on Parsers from "Programming In Haskell"

Dan Weston westondan at imageworks.com
Mon Jun 4 14:47:09 EDT 2007

David House wrote:
> Juozas, you could only use do-notation if your Parser type were
> declared an instance of the Haskell type-class Monad. Seeing as you
> haven't done this, you have to stick to the "de-sugared" version
> involving (>>=) and return:

Is this true? I thought do (like all sugar) was desugared before 
semantic analysis. So long as you have the right >>=, return, and fail 
in scope, I would have thought the desugaring is oblivious to their 
definition (and particularly ignorant of instancing of the Monad typeclass).


More information about the Haskell-Cafe mailing list