summaryrefslogtreecommitdiff
path: root/compiler/prelude/TysPrim.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-12-15 14:22:37 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2015-12-15 14:33:32 +0000
commitb8ca64592e331005def4f734e026d5418950e6e1 (patch)
tree628bc7b0b05d3e1a7da728ef69d362ce3ee30ad5 /compiler/prelude/TysPrim.hs
parent98cdaee73038094eea25d994f1fd0828b3c8dd0e (diff)
downloadhaskell-b8ca64592e331005def4f734e026d5418950e6e1.tar.gz
Comments on equality types and classes
This is really just doucumenting one aspect of the kind-equality patch. See especially Note [Equality types and classes] in TysWiredIn. Other places should just point to this Note. Richard please check for veracity.
Diffstat (limited to 'compiler/prelude/TysPrim.hs')
-rw-r--r--compiler/prelude/TysPrim.hs57
1 files changed, 32 insertions, 25 deletions
diff --git a/compiler/prelude/TysPrim.hs b/compiler/prelude/TysPrim.hs
index 1b5adf6bee..9d3d8297f5 100644
--- a/compiler/prelude/TysPrim.hs
+++ b/compiler/prelude/TysPrim.hs
@@ -476,6 +476,23 @@ mkStatePrimTy ty = TyConApp statePrimTyCon [ty]
statePrimTyCon :: TyCon -- See Note [The State# TyCon]
statePrimTyCon = pcPrimTyCon statePrimTyConName [Nominal] VoidRep
+{-
+RealWorld is deeply magical. It is *primitive*, but it is not
+*unlifted* (hence ptrArg). We never manipulate values of type
+RealWorld; it's only used in the type system, to parameterise State#.
+-}
+
+realWorldTyCon :: TyCon
+realWorldTyCon = mkLiftedPrimTyCon realWorldTyConName liftedTypeKind [] PtrRep
+realWorldTy :: Type
+realWorldTy = mkTyConTy realWorldTyCon
+realWorldStatePrimTy :: Type
+realWorldStatePrimTy = mkStatePrimTy realWorldTy -- State# RealWorld
+
+-- Note: the ``state-pairing'' types are not truly primitive,
+-- so they are defined in \tr{TysWiredIn.hs}, not here.
+
+
voidPrimTy :: Type
voidPrimTy = TyConApp voidPrimTyCon []
@@ -492,6 +509,14 @@ proxyPrimTyCon = mkPrimTyCon proxyPrimTyConName kind [Nominal,Nominal] VoidRep
kv = kKiVar
k = mkTyVarTy kv
+
+{- *********************************************************************
+* *
+ Primitive equality constraints
+ See Note [Equality types and classes] in TysWiredIn
+* *
+********************************************************************* -}
+
eqPrimTyCon :: TyCon -- The representation type for equality predicates
-- See Note [The ~# TyCon]
eqPrimTyCon = mkPrimTyCon eqPrimTyConName kind roles VoidRep
@@ -531,29 +556,12 @@ eqPhantPrimTyCon = mkPrimTyCon eqPhantPrimTyConName kind
k1 = mkTyVarTy kv1
k2 = mkTyVarTy kv2
-{-
-RealWorld is deeply magical. It is *primitive*, but it is not
-*unlifted* (hence ptrArg). We never manipulate values of type
-RealWorld; it's only used in the type system, to parameterise State#.
--}
-
-realWorldTyCon :: TyCon
-realWorldTyCon = mkLiftedPrimTyCon realWorldTyConName liftedTypeKind [] PtrRep
-realWorldTy :: Type
-realWorldTy = mkTyConTy realWorldTyCon
-realWorldStatePrimTy :: Type
-realWorldStatePrimTy = mkStatePrimTy realWorldTy -- State# RealWorld
-{-
-Note: the ``state-pairing'' types are not truly primitive, so they are
-defined in \tr{TysWiredIn.hs}, not here.
-
-************************************************************************
+{- *********************************************************************
* *
-\subsection[TysPrim-arrays]{The primitive array types}
+ The primitive array types
* *
-************************************************************************
--}
+********************************************************************* -}
arrayPrimTyCon, mutableArrayPrimTyCon, mutableByteArrayPrimTyCon,
byteArrayPrimTyCon, arrayArrayPrimTyCon, mutableArrayArrayPrimTyCon,
@@ -584,13 +592,12 @@ mkMutableArrayArrayPrimTy s = TyConApp mutableArrayArrayPrimTyCon [s]
mkSmallMutableArrayPrimTy :: Type -> Type -> Type
mkSmallMutableArrayPrimTy s elt = TyConApp smallMutableArrayPrimTyCon [s, elt]
-{-
-************************************************************************
+
+{- *********************************************************************
* *
-\subsection[TysPrim-mut-var]{The mutable variable type}
+ The mutable variable type
* *
-************************************************************************
--}
+********************************************************************* -}
mutVarPrimTyCon :: TyCon
mutVarPrimTyCon = pcPrimTyCon mutVarPrimTyConName [Nominal, Representational] PtrRep