summaryrefslogtreecommitdiff
path: root/compiler/coreSyn
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/coreSyn')
-rw-r--r--compiler/coreSyn/MkCore.lhs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/coreSyn/MkCore.lhs b/compiler/coreSyn/MkCore.lhs
index c6fc2be21f..656ffa8184 100644
--- a/compiler/coreSyn/MkCore.lhs
+++ b/compiler/coreSyn/MkCore.lhs
@@ -28,6 +28,9 @@ module MkCore (
-- * Constructing/deconstructing equality evidence boxes
mkEqBox,
+ -- * Constructing Coercible evidence
+ mkCoercible,
+
-- * Constructing general big tuples
-- $big_tuples
mkChunkified,
@@ -305,6 +308,11 @@ mkEqBox co = ASSERT2( typeKind ty2 `eqKind` k, ppr co $$ ppr ty1 $$ ppr ty2 $$ p
where Pair ty1 ty2 = coercionKind co
k = typeKind ty1
+mkCoercible :: Coercion -> CoreExpr
+mkCoercible co = ASSERT2( typeKind ty2 `eqKind` k, ppr co $$ ppr ty1 $$ ppr ty2 $$ ppr (typeKind ty1) $$ ppr (typeKind ty2) )
+ Var (dataConWorkId coercibleDataCon) `mkTyApps` [ty1, ty2] `App` Coercion co
+ where Pair ty1 ty2 = coercionKind co
+ k = typeKind ty1
\end{code}
%************************************************************************