%
\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,
mkListTy,
-- * Tuples
- mkTupleTy,
+ mkTupleTy, mkBoxedTupleTy,
tupleTyCon, tupleCon,
unitTyCon, unitDataCon, unitDataConId, pairTyCon,
unboxedSingletonTyCon, unboxedSingletonDataCon,
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
+
+-- | Build the type of a small tuple that holds the specified type of thing
+mkBoxedTupleTy :: [Type] -> Type
+mkBoxedTupleTy tys = mkTupleTy Boxed tys
unitTy :: Type
-unitTy = mkTupleTy Boxed 0 []
+unitTy = mkTupleTy Boxed []
\end{code}
%************************************************************************