-
Simon Peyton Jones authored
--------------------------------------------------- Important fix to the handling of class methods that mention their own class type variable --------------------------------------------------- [NB: I'm not 100% certain that this commit is independent of the Template-Haskell-related commit I'm doing at the same time. I've tried to separate them but may not have succeeded totally.] This bug gives utterly bogus (detected by Core Lint) programs. Isaac Jones discovered it. Here's an example, now enshrined as tc165. class C a where f :: (Eq a) => a instance C () where f = f The instance decl was translated as dfC() = MkC (let f = \dEq -> f in f) which is utterly wrong. Reason: the 'f' on the left was being treated as an available Inst, but it doesn't obey INVARIANT 2 for Insts, which is that they are applied to all their dictionaries. (See the data type decl for Inst.) Solution: don't include such class methods in the available Insts.
115f0fae