[project @ 1996-06-26 10:26:00 by partain]
[ghc-hetmet.git] / ghc / compiler / prelude / TysPrim.lhs
index 876048f..954659a 100644 (file)
@@ -14,15 +14,14 @@ module TysPrim where
 IMP_Ubiq(){-uitous-}
 
 import Kind            ( mkUnboxedTypeKind, mkBoxedTypeKind, mkTypeKind, mkArrowKind )
-import Name            ( mkBuiltinName )
-import PrelMods                ( pRELUDE_BUILTIN )
+import Name            ( mkPrimitiveName )
+import PrelMods                ( gHC_BUILTINS )
 import PrimRep         ( PrimRep(..) ) -- getPrimRepInfo uses PrimRep repn
 import TyCon           ( mkPrimTyCon, mkDataTyCon, NewOrData(..) )
+import Type            ( applyTyCon, mkTyVarTys, mkTyConTy )
 import TyVar           ( GenTyVar(..), alphaTyVars )
-import Type            ( applyTyCon, mkTyVarTys )
 import Usage           ( usageOmega )
 import Unique
-
 \end{code}
 
 \begin{code}
@@ -43,7 +42,7 @@ pcPrimTyCon :: Unique{-TyConKey-} -> FAST_STRING -> Int -> PrimRep -> TyCon
 pcPrimTyCon key str arity primrep
   = mkPrimTyCon name (mk_kind arity) primrep
   where
-    name = mkBuiltinName key pRELUDE_BUILTIN str
+    name = mkPrimitiveName key (OrigName gHC_BUILTINS str)
 
     mk_kind 0 = mkUnboxedTypeKind
     mk_kind n = mkTypeKind `mkArrowKind` mk_kind (n-1)
@@ -121,7 +120,7 @@ realWorldTyCon
        [{-no derivings-}]
        DataType
   where
-    name = mkBuiltinName realWorldTyConKey pRELUDE_BUILTIN SLIT("_RealWorld")
+    name = mkPrimitiveName realWorldTyConKey (OrigName gHC_BUILTINS SLIT("RealWorld"))
 
 realWorldStatePrimTy = mkStatePrimTy realWorldTy
 \end{code}
@@ -129,6 +128,28 @@ realWorldStatePrimTy = mkStatePrimTy realWorldTy
 Note: the ``state-pairing'' types are not truly primitive, so they are
 defined in \tr{TysWiredIn.lhs}, not here.
 
+\begin{code}
+-- The Void type is represented as a data type with no constructors
+-- It's a built in type (i.e. there's no way to define it in Haskell;
+--     the nearest would be
+--
+--             data Void =             -- No constructors!
+--
+-- ) It's boxed; there is only one value of this
+-- type, namely "void", whose semantics is just bottom.
+voidTy = mkTyConTy voidTyCon
+
+voidTyCon
+  = mkDataTyCon name mkBoxedTypeKind 
+       [{-no tyvars-}]
+       [{-no context-}]
+       [{-no data cons!-}]
+       [{-no derivings-}]
+       DataType
+  where
+    name = mkPrimitiveName voidTyConKey (OrigName gHC_BUILTINS SLIT("Void"))
+\end{code}
+
 %************************************************************************
 %*                                                                     *
 \subsection[TysPrim-arrays]{The primitive array types}