summaryrefslogtreecommitdiff
path: root/compiler/basicTypes
diff options
context:
space:
mode:
authorJose Pedro Magalhaes <jpm@cs.uu.nl>2011-12-06 11:41:02 +0000
committerJose Pedro Magalhaes <jpm@cs.uu.nl>2011-12-22 16:30:04 +0000
commitf031ce2ef840f8f1c7ecb2164754324a37db5ad8 (patch)
tree16468cec65421164dcf013b4569994e807ea44fb /compiler/basicTypes
parentacbb3dba4490d53762b5aecfb9a45049dea15c79 (diff)
downloadhaskell-f031ce2ef840f8f1c7ecb2164754324a37db5ad8.tar.gz
Represent type family instances by CoAxioms, not TyCons.
A few issues still remain to be addressed.
Diffstat (limited to 'compiler/basicTypes')
-rw-r--r--compiler/basicTypes/MkId.lhs11
-rw-r--r--compiler/basicTypes/OccName.lhs2
2 files changed, 12 insertions, 1 deletions
diff --git a/compiler/basicTypes/MkId.lhs b/compiler/basicTypes/MkId.lhs
index a40d46f8a9..f3922fe40b 100644
--- a/compiler/basicTypes/MkId.lhs
+++ b/compiler/basicTypes/MkId.lhs
@@ -26,6 +26,7 @@ module MkId (
mkReboxingAlt, wrapNewTypeBody, unwrapNewTypeBody,
wrapFamInstBody, unwrapFamInstScrut,
+ wrapTypeFamInstBody, unwrapTypeFamInstScrut,
mkUnpackCase, mkProductBox,
-- And some particular Ids; see below for why they are wired in
@@ -709,12 +710,22 @@ wrapFamInstBody tycon args body
| otherwise
= body
+-- Same as `wrapFamInstBody`, but for type family instances, which are
+-- represented by a `CoAxiom`, and not a `TyCon`
+wrapTypeFamInstBody :: CoAxiom -> [Type] -> CoreExpr -> CoreExpr
+wrapTypeFamInstBody axiom args body
+ = mkCast body (mkSymCo (mkAxInstCo axiom args))
+
unwrapFamInstScrut :: TyCon -> [Type] -> CoreExpr -> CoreExpr
unwrapFamInstScrut tycon args scrut
| Just co_con <- tyConFamilyCoercion_maybe tycon
= mkCast scrut (mkAxInstCo co_con args)
| otherwise
= scrut
+
+unwrapTypeFamInstScrut :: CoAxiom -> [Type] -> CoreExpr -> CoreExpr
+unwrapTypeFamInstScrut axiom args scrut
+ = mkCast scrut (mkAxInstCo axiom args)
\end{code}
diff --git a/compiler/basicTypes/OccName.lhs b/compiler/basicTypes/OccName.lhs
index 9f8f32d1b3..faefa26dd5 100644
--- a/compiler/basicTypes/OccName.lhs
+++ b/compiler/basicTypes/OccName.lhs
@@ -371,7 +371,7 @@ sequentially starting at 0.
So we can make a Unique using
mkUnique ns key :: Unique
-where 'ns' is a Char reprsenting the name space. This in turn makes it
+where 'ns' is a Char representing the name space. This in turn makes it
easy to build an OccEnv.
\begin{code}