5 Jun
2007
5 Jun
'07
12:28 a.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 }".