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

Albert Y. C. Lai trebla at vex.net
Mon Jun 4 14:58:09 EDT 2007

Dan Weston wrote:
> 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).

Some compilers also type-check when desugaring; if actions in the 
do-block are not of a Monad instance type, it is rejected. See also an 
earlier thread on the validity of "do { 1 }".

More information about the Haskell-Cafe mailing list