summaryrefslogtreecommitdiff
path: root/compiler/types/Type.lhs
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2013-11-27 16:15:46 +0000
committerJoachim Breitner <mail@joachim-breitner.de>2013-11-27 16:15:49 +0000
commit808ded9c03be25548a8954e61115af5ccd6f2241 (patch)
tree6f89345d18a76af8909c52e6b73d094403381e0e /compiler/types/Type.lhs
parentaef90447a7eb92462f0af5e81f40965fb55fdae7 (diff)
downloadhaskell-808ded9c03be25548a8954e61115af5ccd6f2241.tar.gz
Get rid of EvCoercible
and use EvCoercion to describe the evidence for Coercible instances.
Diffstat (limited to 'compiler/types/Type.lhs')
-rw-r--r--compiler/types/Type.lhs11
1 files changed, 9 insertions, 2 deletions
diff --git a/compiler/types/Type.lhs b/compiler/types/Type.lhs
index d45cd8c6ef..0abe463f18 100644
--- a/compiler/types/Type.lhs
+++ b/compiler/types/Type.lhs
@@ -48,7 +48,7 @@ module Type (
-- Pred types
mkFamilyTyConApp,
isDictLikeTy,
- mkEqPred, mkPrimEqPred, mkReprPrimEqPred,
+ mkEqPred, mkCoerciblePred, mkPrimEqPred, mkReprPrimEqPred,
mkClassPred,
noParenPred, isClassPred, isEqPred,
isIPPred, isIPPred_maybe, isIPTyCon, isIPClass,
@@ -160,7 +160,7 @@ import NameEnv
import Class
import TyCon
import TysPrim
-import {-# SOURCE #-} TysWiredIn ( eqTyCon, typeNatKind, typeSymbolKind )
+import {-# SOURCE #-} TysWiredIn ( eqTyCon, coercibleTyCon, typeNatKind, typeSymbolKind )
import PrelNames ( eqTyConKey, coercibleTyConKey,
ipClassNameKey, openTypeKindTyConKey,
constraintKindTyConKey, liftedTypeKindTyConKey )
@@ -899,6 +899,13 @@ mkEqPred ty1 ty2
where
k = typeKind ty1
+mkCoerciblePred :: Type -> Type -> PredType
+mkCoerciblePred ty1 ty2
+ = WARN( not (k `eqKind` typeKind ty2), ppr ty1 $$ ppr ty2 $$ ppr k $$ ppr (typeKind ty2) )
+ TyConApp coercibleTyCon [k, ty1, ty2]
+ where
+ k = typeKind ty1
+
mkPrimEqPred :: Type -> Type -> Type
mkPrimEqPred ty1 ty2
= WARN( not (k `eqKind` typeKind ty2), ppr ty1 $$ ppr ty2 )