Repository : ssh://darcs.haskell.org//srv/darcs/ghc On branch : master
http://hackage.haskell.org/trac/ghc/changeset/98a642cf29781ebd33994a4ecbea6ef07f89bbed >--------------------------------------------------------------- commit 98a642cf29781ebd33994a4ecbea6ef07f89bbed Author: Simon Peyton Jones <[email protected]> Date: Tue Jan 3 10:35:08 2012 +0000 Major refactoring of CoAxioms This patch should have no user-visible effect. It implements a significant internal refactoring of the way that FC axioms are handled. The ultimate goal is to put us in a position to implement "pattern-matching axioms". But the changes here are only does refactoring; there is no change in functionality. Specifically: * We now treat data/type family instance declarations very, very similarly to types class instance declarations: - Renamed InstEnv.Instance as InstEnv.ClsInst, for symmetry with FamInstEnv.FamInst. This change does affect the GHC API, but for the better I think. - Previously, each family type/data instance declaration gave rise to a *TyCon*; typechecking a type/data instance decl produced that TyCon. Now, each type/data instance gives rise to a *FamInst*, by direct analogy with each class instance declaration giving rise to a ClsInst. - Just as each ClsInst contains its evidence, a DFunId, so each FamInst contains its evidence, a CoAxiom. See Note [FamInsts and CoAxioms] in FamInstEnv. The CoAxiom is a System-FC thing, and can relate any two types, whereas the FamInst relates directly to the Haskell source language construct, and always has a function (F tys) on the LHS. - Just as a DFunId has its own declaration in an interface file, so now do CoAxioms (see IfaceSyn.IfaceAxiom). These changes give rise to almost all the refactoring. * We used to have a hack whereby a type family instance produced a dummy type synonym, thus type instance F Int = Bool -> Bool translated to axiom FInt :: F Int ~ R:FInt type R:FInt = Bool -> Bool This was always a hack, and now it's gone. Instead the type instance declaration produces a FamInst, whose axiom has kind axiom FInt :: F Int ~ Bool -> Bool just as you'd expect. * Newtypes are done just as before; they generate a CoAxiom. These CoAxioms are "implicit" (do not generate an IfaceAxiom declaration), unlike the ones coming from family instance declarations. See Note [Implicit axioms] in TyCon On the whole the code gets significantly nicer. There were consequential tidy-ups in the vectoriser, but I think I got them right. compiler/basicTypes/MkId.lhs | 13 +- compiler/basicTypes/OccName.lhs | 22 +-- compiler/coreSyn/CoreSyn.lhs | 4 +- compiler/hsSyn/HsDecls.lhs | 2 +- compiler/iface/BinIface.hs | 45 +++-- compiler/iface/BuildTyCl.lhs | 71 ++----- compiler/iface/IfaceSyn.lhs | 147 ++++++------- compiler/iface/LoadIface.lhs | 6 +- compiler/iface/MkIface.lhs | 135 +++++++----- compiler/iface/TcIface.lhs | 74 ++++--- compiler/iface/TcIface.lhs-boot | 6 +- compiler/main/GHC.hs | 8 +- compiler/main/HscMain.hs | 2 +- compiler/main/HscTypes.lhs | 63 ++++-- compiler/main/InteractiveEval.hs | 2 +- compiler/main/TidyPgm.lhs | 2 +- compiler/rename/RnEnv.lhs | 74 ++++--- compiler/typecheck/FamInst.lhs | 14 +- compiler/typecheck/Inst.lhs | 14 +- compiler/typecheck/TcDeriv.lhs | 13 +- compiler/typecheck/TcEnv.lhs | 25 ++- compiler/typecheck/TcExpr.lhs | 9 +- compiler/typecheck/TcGenDeriv.lhs | 7 +- compiler/typecheck/TcGenGenerics.lhs | 33 ++-- compiler/typecheck/TcInstDcls.lhs | 166 +++++++------- compiler/typecheck/TcInteract.lhs | 16 +- compiler/typecheck/TcMType.lhs | 3 +- compiler/typecheck/TcPat.lhs | 3 + compiler/typecheck/TcRnDriver.lhs | 16 +- compiler/typecheck/TcRnTypes.lhs | 2 +- compiler/typecheck/TcSMonad.lhs | 5 +- compiler/typecheck/TcSplice.lhs | 31 ++-- compiler/typecheck/TcTyClsDecls.lhs | 15 +- compiler/types/Coercion.lhs | 70 ++++-- compiler/types/FamInstEnv.lhs | 250 ++++++++++++++------- compiler/types/FunDeps.lhs | 12 +- compiler/types/InstEnv.lhs | 74 +++--- compiler/types/Kind.lhs | 2 +- compiler/types/TyCon.lhs | 147 ++++++------- compiler/vectorise/Vectorise/Generic/PADict.hs | 7 +- compiler/vectorise/Vectorise/Generic/PAMethods.hs | 49 ++--- compiler/vectorise/Vectorise/Generic/PData.hs | 59 +++--- compiler/vectorise/Vectorise/Monad/InstEnv.hs | 3 +- compiler/vectorise/Vectorise/Monad/Naming.hs | 30 ++- compiler/vectorise/Vectorise/Type/Env.hs | 24 ++- compiler/vectorise/Vectorise/Type/TyConDecl.hs | 3 +- compiler/vectorise/Vectorise/Utils/Base.hs | 1 - compiler/vectorise/Vectorise/Utils/PADict.hs | 11 +- ghc/InteractiveUI.hs | 4 +- 49 files changed, 964 insertions(+), 830 deletions(-) Diff suppressed because of size. To see it, use: git show 98a642cf29781ebd33994a4ecbea6ef07f89bbed _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
