diff options
author | Richard Eisenberg <rae@cs.brynmawr.edu> | 2017-04-07 11:39:51 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-05-02 23:07:27 -0400 |
commit | 466803a0e9628ccd5feb55d062e141e0972fc19c (patch) | |
tree | 2dc21069c906a377e54e7647dd2010252ca80b42 | |
parent | ef0ff34d462e3780210567a13d58b868ec3399e0 (diff) | |
download | haskell-466803a0e9628ccd5feb55d062e141e0972fc19c.tar.gz |
Use mkCastTy in subst_ty.
This allows mkCastTy to maintain invariants. Much like how
we use mkAppTy in subst_ty.
-rw-r--r-- | compiler/types/TyCoRep.hs | 4 | ||||
-rw-r--r-- | compiler/types/Type.hs | 11 | ||||
-rw-r--r-- | compiler/types/Type.hs-boot | 3 |
3 files changed, 4 insertions, 14 deletions
diff --git a/compiler/types/TyCoRep.hs b/compiler/types/TyCoRep.hs index 52a0f1d8b4..300ef80a8f 100644 --- a/compiler/types/TyCoRep.hs +++ b/compiler/types/TyCoRep.hs @@ -135,7 +135,7 @@ module TyCoRep ( import {-# SOURCE #-} DataCon( dataConFullSig , dataConUnivTyVarBinders, dataConExTyVarBinders , DataCon, filterEqSpec ) -import {-# SOURCE #-} Type( isPredTy, isCoercionTy, mkAppTy +import {-# SOURCE #-} Type( isPredTy, isCoercionTy, mkAppTy, mkCastTy , tyCoVarsOfTypesWellScoped , tyCoVarsOfTypeWellScoped , coreView, typeKind ) @@ -2186,7 +2186,7 @@ subst_ty subst ty (ForAllTy $! ((TvBndr $! tv') vis)) $! (subst_ty subst' ty) go (LitTy n) = LitTy $! n - go (CastTy ty co) = (CastTy $! (go ty)) $! (subst_co subst co) + go (CastTy ty co) = (mkCastTy $! (go ty)) $! (subst_co subst co) go (CoercionTy co) = CoercionTy $! (subst_co subst co) substTyVar :: TCvSubst -> TyVar -> Type diff --git a/compiler/types/Type.hs b/compiler/types/Type.hs index e0a98e987f..7750a35072 100644 --- a/compiler/types/Type.hs +++ b/compiler/types/Type.hs @@ -1222,10 +1222,6 @@ mkCastTy ty co | isReflexiveCo co = ty mkCastTy (CastTy ty co1) co2 = mkCastTy ty (co1 `mkTransCo` co2) mkCastTy ty co = CastTy ty co -tyConTyBinders :: TyCon -> [TyBinder] --- Return the tyConBinders in TyBinder form -tyConTyBinders tycon = tyConBindersTyBinders (tyConBinders tycon) - tyConBindersTyBinders :: [TyConBinder] -> [TyBinder] -- Return the tyConBinders in TyBinder form tyConBindersTyBinders = map to_tyb @@ -1529,13 +1525,6 @@ caseBinder :: TyBinder -- ^ binder to scrutinize caseBinder (Named v) f _ = f v caseBinder (Anon t) _ d = d t --- | Create a TCvSubst combining the binders and types provided. --- NB: It is specifically OK if the lists are of different lengths. --- Barely used -zipTyBinderSubst :: [TyBinder] -> [Type] -> TCvSubst -zipTyBinderSubst bndrs tys - = mkTvSubstPrs [ (tv, ty) | (Named (TvBndr tv _), ty) <- zip bndrs tys ] - -- | Manufacture a new 'TyConBinder' from a 'TyBinder'. Anonymous -- 'TyBinder's are still assigned names as 'TyConBinder's, so we need -- the extra gunk with which to construct a 'Name'. Used when producing diff --git a/compiler/types/Type.hs-boot b/compiler/types/Type.hs-boot index be7e4ed82a..2fc251acb7 100644 --- a/compiler/types/Type.hs-boot +++ b/compiler/types/Type.hs-boot @@ -3,13 +3,14 @@ module Type where import TyCon import Var ( TyVar ) -import {-# SOURCE #-} TyCoRep( Type, Kind ) +import {-# SOURCE #-} TyCoRep( Type, Coercion, Kind ) import Util isPredTy :: Type -> Bool isCoercionTy :: Type -> Bool mkAppTy :: Type -> Type -> Type +mkCastTy :: Type -> Coercion -> Type piResultTy :: Type -> Type -> Type typeKind :: Type -> Kind |