
4 Jun
2007
4 Jun
'07
2:58 p.m.
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 }".