diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2013-01-28 08:18:28 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2013-01-28 08:18:28 +0000 |
commit | a98e51ecf51d1a93d48a8a10d35827edfd9d8c28 (patch) | |
tree | efbeaf6f61ddc479a6510357644d6b94b2cdd23d /compiler/vectorise | |
parent | 351a8c6bbd53ce07d687b5a96afff77c4c9910cc (diff) | |
download | haskell-a98e51ecf51d1a93d48a8a10d35827edfd9d8c28.tar.gz |
More refactoring of FamInst/FamInstEnv; finally fixes Trac #7524
Quite a bit of tidying up here; the fix to #7524 is actually
only a small part.
* Be fully clear that the cab_tvs in a CoAxBranch are not
fresh. See Note [CoAxBranch type variables] in CoAxiom.
* Use CoAxBranch to replace the ATDfeault type in Class.
CoAxBranch is perfect here. This change allowed me to
delete quite a bit of boilerplate code, including the
corresponding IfaceSynType.
* Tidy up the construction of CoAxBranches, and when FamIntBranch is
freshened. The latter onw happens only in FamInst.newFamInst.
* Tidy the tyvars of a CoAxBranch when we build them, done in
FamInst.mkCoAxBranch. See Note [Tidy axioms when we build them]
in that module. This is what fixes #7524.
Much niceer now.
Diffstat (limited to 'compiler/vectorise')
-rw-r--r-- | compiler/vectorise/Vectorise/Generic/PAMethods.hs | 4 | ||||
-rw-r--r-- | compiler/vectorise/Vectorise/Generic/PData.hs | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/compiler/vectorise/Vectorise/Generic/PAMethods.hs b/compiler/vectorise/Vectorise/Generic/PAMethods.hs index f5cbf93434..af815c9294 100644 --- a/compiler/vectorise/Vectorise/Generic/PAMethods.hs +++ b/compiler/vectorise/Vectorise/Generic/PAMethods.hs @@ -23,7 +23,6 @@ import Type import OccName import Coercion import MkId -import Name import FamInst import DynFlags @@ -38,7 +37,8 @@ buildPReprTyCon orig_tc vect_tc repr = do name <- mkLocalisedName mkPReprTyConOcc (tyConName orig_tc) rhs_ty <- sumReprType repr prepr_tc <- builtin preprTyCon - liftDs $ mkFreshenedSynInstLoc (getSrcSpan name) name tyvars prepr_tc instTys rhs_ty + let axiom = mkSingleCoAxiom name tyvars prepr_tc instTys rhs_ty + liftDs $ newFamInst SynFamilyInst False axiom where tyvars = tyConTyVars vect_tc instTys = [mkTyConApp vect_tc . mkTyVarTys $ tyConTyVars vect_tc] diff --git a/compiler/vectorise/Vectorise/Generic/PData.hs b/compiler/vectorise/Vectorise/Generic/PData.hs index cbedf8d8e0..f2b9f7ab9c 100644 --- a/compiler/vectorise/Vectorise/Generic/PData.hs +++ b/compiler/vectorise/Vectorise/Generic/PData.hs @@ -19,6 +19,7 @@ import BuildTyCl import DataCon import TyCon import Type +import FamInst import FamInstEnv import TcMType import Name @@ -45,9 +46,10 @@ buildDataFamInst name' fam_tc vect_tc rhs = do { axiom_name <- mkDerivedName mkInstTyCoOcc name' ; (_, tyvars') <- liftDs $ tcInstSkolTyVarsLoc (getSrcSpan name') tyvars - ; let fam_inst = mkDataFamInst axiom_name tyvars' fam_tc pat_tys rep_tc - ax = famInstAxiom fam_inst - pat_tys = [mkTyConApp vect_tc (mkTyVarTys tyvars')] + ; let ax = mkSingleCoAxiom axiom_name tyvars' fam_tc pat_tys rep_ty + tys' = mkTyVarTys tyvars' + rep_ty = mkTyConApp rep_tc tys' + pat_tys = [mkTyConApp vect_tc tys'] rep_tc = buildAlgTyCon name' tyvars' Nothing @@ -57,7 +59,7 @@ buildDataFamInst name' fam_tc vect_tc rhs False -- Not promotable False -- not GADT syntax (FamInstTyCon ax fam_tc pat_tys) - ; return fam_inst } + ; liftDs $ newFamInst (DataFamilyInst rep_tc) False ax } where tyvars = tyConTyVars vect_tc rec_flag = boolToRecFlag (isRecursiveTyCon vect_tc) |