summaryrefslogtreecommitdiff
path: root/compiler/prelude
diff options
context:
space:
mode:
authorRichard Eisenberg <rae@richarde.dev>2019-10-03 23:20:13 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-10-16 15:58:58 -0400
commit51fad9e6693fdf8964d104425122d0010229c939 (patch)
tree8268d84ed6f18ac3df26e5c7475f2aa9cd54ad54 /compiler/prelude
parent798037a1f6823c72e3ba59ed726d0ff74d0245e8 (diff)
downloadhaskell-51fad9e6693fdf8964d104425122d0010229c939.tar.gz
Break up TcRnTypes, among other modules.
This introduces three new modules: - basicTypes/Predicate.hs describes predicates, moving this logic out of Type. Predicates don't really exist in Core, and so don't belong in Type. - typecheck/TcOrigin.hs describes the origin of constraints and types. It was easy to remove from other modules and can often be imported instead of other, scarier modules. - typecheck/Constraint.hs describes constraints as used in the solver. It is taken from TcRnTypes. No work other than module splitting is in this patch. This is the first step toward homogeneous equality, which will rely more strongly on predicates. And homogeneous equality is the next step toward a dependently typed core language.
Diffstat (limited to 'compiler/prelude')
-rw-r--r--compiler/prelude/TysPrim.hs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs
index 27c7318805..79a30482b0 100644
--- a/compiler/prelude/TysPrim.hs
+++ b/compiler/prelude/TysPrim.hs
@@ -81,6 +81,7 @@ module TysPrim(
eqPrimTyCon, -- ty1 ~# ty2
eqReprPrimTyCon, -- ty1 ~R# ty2 (at role Representational)
eqPhantPrimTyCon, -- ty1 ~P# ty2 (at role Phantom)
+ equalityTyCon,
-- * SIMD
#include "primop-vector-tys-exports.hs-incl"
@@ -919,6 +920,12 @@ eqPhantPrimTyCon = mkPrimTyCon eqPhantPrimTyConName binders res_kind roles
res_kind = unboxedTupleKind []
roles = [Nominal, Nominal, Phantom, Phantom]
+-- | Given a Role, what TyCon is the type of equality predicates at that role?
+equalityTyCon :: Role -> TyCon
+equalityTyCon Nominal = eqPrimTyCon
+equalityTyCon Representational = eqReprPrimTyCon
+equalityTyCon Phantom = eqPhantPrimTyCon
+
{- *********************************************************************
* *
The primitive array types