%
\section[TysWiredIn]{Wired-in knowledge about {\em non-primitive} types}
-This module tracks the ``state interface'' document, ``GHC prelude:
-types and operations.''
-
\begin{code}
-- | This module is about types that can be defined in Haskell, but which
--- must be wired into the compiler nonetheless.
+-- must be wired into the compiler nonetheless. C.f module TysPrim
module TysWiredIn (
-- * All wired in things
wiredInTyCons,
parrTyCon_RDR, parrTyConName
) where
+#include "HsVersions.h"
+
import {-# SOURCE #-} MkId( mkDataConIds )
-- friends:
import Constants ( mAX_TUPLE_SIZE )
import Module ( Module )
import RdrName
-import Name ( Name, BuiltInSyntax(..), nameUnique, nameOccName,
- nameModule, mkWiredInName )
-import OccName ( mkTcOccFS, mkDataOccFS, mkTupleOcc, mkDataConWorkerOcc,
- tcName, dataName )
+import Name
import DataCon ( DataCon, mkDataCon, dataConWorkId, dataConSourceArity )
import Var
import TyCon ( TyCon, AlgTyConRhs(DataTyCon), tyConDataCons,
import TypeRep ( mkArrowKinds, liftedTypeKind, ubxTupleKind )
import Unique ( incrUnique, mkTupleTyConUnique,
mkTupleDataConUnique, mkPArrDataConUnique )
-import Array
+import Data.Array
import FastString
import Outputable
tyvars
[] -- No stupid theta
(DataTyCon cons is_enum)
- [] -- No record selectors
NoParentTyCon
is_rec
True -- All the wired-in tycons have generics
[] -- No existential type variables
[] -- No equality spec
[] -- No theta
- arg_tys tycon
+ arg_tys (mkTyConApp tycon (mkTyVarTys tyvars))
+ tycon
[] -- No stupid theta
(mkDataConIds bogus_wrap_name wrk_name data_con)
- modu = nameModule dc_name
+ modu = ASSERT( isExternalName dc_name )
+ nameModule dc_name
wrk_occ = mkDataConWorkerOcc (nameOccName dc_name)
wrk_key = incrUnique (nameUnique dc_name)
wrk_name = mkWiredInName modu wrk_occ wrk_key
unboxedPairDataCon = tupleCon Unboxed 2
\end{code}
+
%************************************************************************
%* *
\subsection[TysWiredIn-boxed-prim]{The ``boxed primitive'' types (@Char@, @Int@, etc)}
\end{itemize}
\begin{code}
-mkTupleTy :: Boxity -> Int -> [Type] -> Type
-mkTupleTy boxity arity tys = mkTyConApp (tupleTyCon boxity arity) tys
+mkTupleTy :: Boxity -> [Type] -> Type
+-- Special case for *boxed* 1-tuples, which are represented by the type itself
+mkTupleTy boxity [ty] | Boxed <- boxity = ty
+mkTupleTy boxity tys = mkTyConApp (tupleTyCon boxity (length tys)) tys
unitTy :: Type
-unitTy = mkTupleTy Boxed 0 []
+unitTy = mkTupleTy Boxed []
\end{code}
%************************************************************************