Mon Dec 13 09:15:11 PST 2010 [email protected]
* Fix recursive superclasses (again). Fixes Trac #4809.
This patch finally deals with the super-delicate question of
superclases in possibly-recursive dictionaries. The key idea
is the DFun Superclass Invariant (see TcInstDcls):
In the body of a DFun, every superclass argument to the
returned dictionary is
either * one of the arguments of the DFun,
or * constant, bound at top level
To establish the invariant, we add new "silent" superclass
argument(s) to each dfun, so that the dfun does not do superclass
selection internally. There's a bit of hoo-ha to make sure that
we don't print those silent arguments in error messages; a knock
on effect was a change in interface-file format.
A second change is that instead of the complex and fragile
"self dictionary binding" in TcInstDcls and TcClassDcl,
using the same mechanism for existential pattern bindings.
See Note [Subtle interaction of recursion and overlap] in TcInstDcls
and Note [Binding when looking up instances] in InstEnv.
Main notes are here:
* Note [Silent Superclass Arguments] in TcInstDcls,
including the DFun Superclass Invariant
Main code changes are:
* The code for MkId.mkDictFunId and mkDictFunTy
* DFunUnfoldings get a little more complicated;
their arguments are a new type DFunArg (in CoreSyn)
* No "self" argument in tcInstanceMethod
* No special tcSimplifySuperClasss
* No "dependents" argument to EvDFunApp
IMPORTANT
It turns out that it's quite tricky to generate the right
DFunUnfolding for a specialised dfun, when you use SPECIALISE
INSTANCE. For now I've just commented it out (in DsBinds) but
that'll lose some optimisation, and I need to get back to
this.
M! ./compiler/basicTypes/Id.lhs -8 +3
M! ./compiler/basicTypes/IdInfo.lhs -14 +6
M! ./compiler/basicTypes/MkId.lhs -24 +12
M! ./compiler/coreSyn/CoreSubst.lhs -3 +1
M! ./compiler/coreSyn/CoreSyn.lhs -27 +9
M! ./compiler/coreSyn/CoreTidy.lhs -1 +1
M! ./compiler/coreSyn/CoreUnfold.lhs -6 +4
M! ./compiler/coreSyn/CoreUtils.lhs -1 +1
M! ./compiler/coreSyn/PprCore.lhs -6 +2
M! ./compiler/deSugar/DsBinds.lhs -11 +25
M! ./compiler/hsSyn/HsBinds.lhs -3
M! ./compiler/hsSyn/HsExpr.lhs-boot -4
M! ./compiler/hsSyn/HsPat.lhs-boot -1
M! ./compiler/iface/BinIface.hs -13 +2
M! ./compiler/iface/IfaceSyn.lhs -8 +6
M! ./compiler/iface/MkIface.lhs -2 +2
M! ./compiler/iface/TcIface.lhs -6 +3
M! ./compiler/main/TidyPgm.lhs -1 +1
M! ./compiler/simplCore/Simplify.lhs -1 +1
M! ./compiler/typecheck/Inst.lhs -12 +4
M! ./compiler/typecheck/TcClassDcl.lhs -6 +15
M! ./compiler/typecheck/TcDeriv.lhs -22 +21
M! ./compiler/typecheck/TcEnv.lhs -2 +2
M! ./compiler/typecheck/TcErrors.lhs -10 +9
M! ./compiler/typecheck/TcHsSyn.lhs -2 +2
M! ./compiler/typecheck/TcHsType.lhs -30 +28
M! ./compiler/typecheck/TcInstDcls.lhs -150 +153
M! ./compiler/typecheck/TcInteract.lhs -3 +2
M! ./compiler/typecheck/TcMType.lhs -33 +46
M! ./compiler/typecheck/TcSMonad.lhs -2 +2
M! ./compiler/typecheck/TcSimplify.lhs -6 +5
M! ./compiler/typecheck/TcType.lhs -8 +5
M! ./compiler/typecheck/TcUnify.lhs -5 +8
M! ./compiler/types/InstEnv.lhs -16 +6
View patch online:
http://darcs.haskell.org/cgi-bin/darcsweb.cgi?r=ghc-7.0/ghc;a=darcs_commitdiff;h=20101213171511-1287e-faf1de7024f5deb63b19666a0569e10aee5c9bec.gz
_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc