• simonpj@microsoft.com's avatar
    Make rebindable do-notation behave as advertised · 1d1c3c72
    simonpj@microsoft.com authored
    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.
TcPat.lhs 41.2 KB