Make rebindable do-notation behave as advertised
authorsimonpj@microsoft.com <unknown>
Wed, 21 Nov 2007 17:49:14 +0000 (17:49 +0000)
committersimonpj@microsoft.com <unknown>
Wed, 21 Nov 2007 17:49:14 +0000 (17:49 +0000)
commit1d1c3c727617630beacacaf33022e1daba06a0bb
tree98b2e44c71b0667f94cad7d98f1d49de92d23993
parent9226af9eef1cc45dd745ce21ddeb36a0be0da708
Make rebindable do-notation behave as advertised

Adopt Trac #1537.  The patch ended up a bit bigger than I expected,
so I suggest we do not merge this into the 6.8 branch.  But there
is no funadamental reason why not.

With this patch, rebindable do-notation really does type as if you
had written the original (>>) and (>>=) operations in desguared form.

I ended up refactoring some of the (rather complicated) error-context
stuff in TcUnify, by pushing an InstOrigin into tcSubExp and its
various calls. That means we could get rid of tcFunResTy, and the
SubCtxt type.  This should improve error messages slightly
in complicated situations, because we have an Origin to hand
to instCall (in the (isSigmaTy actual_ty) case of tc_sub1).

Thanks to Pepe for the first draft of the patch.
compiler/typecheck/TcBinds.lhs
compiler/typecheck/TcExpr.lhs
compiler/typecheck/TcMatches.lhs
compiler/typecheck/TcPat.lhs
compiler/typecheck/TcRnDriver.lhs
compiler/typecheck/TcRnTypes.lhs
compiler/typecheck/TcUnify.lhs