-
Simon Peyton Jones authored
Don Stewart and Duncan Coutts encountered the following situation. f = <rhs> {-# RULES f ... #-} where f is not exported, but appears in the inlinings of other functions that are exported. Then what happened was that the desugarer produced this: M.f = f f = <rhs> where the rules get attached to the M.f. But since M.f's RHS is trivial (just f) it was unconditionally inlinined at all its call sites, thereby losing the RULES attached to it. This *is* a fragile aspect of rules. However this fix solves the problem by instead generating f = M.f M.f = <rhs> A pretty small chanage to the desugarer does the job. It still feels a little fragile, bt it's certainly more robust than before.
4fbd341b