diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-06-24 22:35:32 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-06-26 08:33:04 +0100 |
commit | ff8a67164b294b5eb6caee38ec59e7e400e025dc (patch) | |
tree | 66ff5cd8dd34c9c804fcf04dd0612063fde47f9d /compiler/vectorise | |
parent | 9195927d093504e233225dfb40f2f6b95a78925e (diff) | |
download | haskell-ff8a67164b294b5eb6caee38ec59e7e400e025dc.tar.gz |
Use a Representaional coercion for data families
When we have
data instance T (a,b) = MkT a b
we make a represntation type
data TPair a b = MkT a b
plus an axiom to connect the two
ax a b :: T (a,b) ~R TPair a b
Previously this was a Nominal equality, and that worked ok
but seems illogical since Nominal equalities are between
types that the programmer thinks of as being equal. But
TPair is not visible to the programmer; indeed we call it
the "representation TyCon". So a Representational equality
seems more suitable here.
Diffstat (limited to 'compiler/vectorise')
-rw-r--r-- | compiler/vectorise/Vectorise/Generic/PAMethods.hs | 2 | ||||
-rw-r--r-- | compiler/vectorise/Vectorise/Generic/PData.hs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/compiler/vectorise/Vectorise/Generic/PAMethods.hs b/compiler/vectorise/Vectorise/Generic/PAMethods.hs index 2f4e23e393..b5626bd566 100644 --- a/compiler/vectorise/Vectorise/Generic/PAMethods.hs +++ b/compiler/vectorise/Vectorise/Generic/PAMethods.hs @@ -38,7 +38,7 @@ buildPReprTyCon orig_tc vect_tc repr = do name <- mkLocalisedName mkPReprTyConOcc (tyConName orig_tc) rhs_ty <- sumReprType repr prepr_tc <- builtin preprTyCon - let axiom = mkSingleCoAxiom name tyvars prepr_tc instTys rhs_ty + let axiom = mkSingleCoAxiom Nominal name tyvars prepr_tc instTys rhs_ty liftDs $ newFamInst SynFamilyInst axiom where tyvars = tyConTyVars vect_tc diff --git a/compiler/vectorise/Vectorise/Generic/PData.hs b/compiler/vectorise/Vectorise/Generic/PData.hs index 387d49c3ad..ed127b449f 100644 --- a/compiler/vectorise/Vectorise/Generic/PData.hs +++ b/compiler/vectorise/Vectorise/Generic/PData.hs @@ -46,7 +46,7 @@ buildDataFamInst name' fam_tc vect_tc rhs = do { axiom_name <- mkDerivedName mkInstTyCoOcc name' ; (_, tyvars') <- liftDs $ tcInstSigTyVarsLoc (getSrcSpan name') tyvars - ; let ax = mkSingleCoAxiom axiom_name tyvars' fam_tc pat_tys rep_ty + ; let ax = mkSingleCoAxiom Representational axiom_name tyvars' fam_tc pat_tys rep_ty tys' = mkTyVarTys tyvars' rep_ty = mkTyConApp rep_tc tys' pat_tys = [mkTyConApp vect_tc tys'] |