X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fprelude%2FTysWiredIn.lhs;h=4695c87e8681f7dd9bf9cc55b7e7ef4f2b680732;hb=170a6564229788618fb86fbb3be6662bf8e566a0;hp=83c3f450224913b681fa4b1146548626f08ed62a;hpb=1e50fd4185479a62e02d987bdfcb1c62712859ca;p=ghc-hetmet.git diff --git a/compiler/prelude/TysWiredIn.lhs b/compiler/prelude/TysWiredIn.lhs index 83c3f45..4695c87 100644 --- a/compiler/prelude/TysWiredIn.lhs +++ b/compiler/prelude/TysWiredIn.lhs @@ -3,12 +3,9 @@ % \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, @@ -41,7 +38,7 @@ module TysWiredIn ( mkListTy, -- * Tuples - mkTupleTy, + mkTupleTy, mkBoxedTupleTy, tupleTyCon, tupleCon, unitTyCon, unitDataCon, unitDataConId, pairTyCon, unboxedSingletonTyCon, unboxedSingletonDataCon, @@ -75,8 +72,7 @@ import TyCon ( TyCon, AlgTyConRhs(DataTyCon), tyConDataCons, mkTupleTyCon, mkAlgTyCon, tyConName, TyConParent(NoParentTyCon) ) -import BasicTypes ( Arity, RecFlag(..), Boxity(..), isBoxed, - StrictnessMark(..) ) +import BasicTypes ( Arity, RecFlag(..), Boxity(..), isBoxed, HsBang(..) ) import Type ( Type, mkTyConTy, mkTyConApp, mkTyVarTy, mkTyVarTys, TyThing(..) ) @@ -241,7 +237,7 @@ pcDataConWithFixity declared_infix dc_name tyvars arg_tys tycon = data_con where data_con = mkDataCon dc_name declared_infix - (map (const NotMarkedStrict) arg_tys) + (map (const HsNoBang) arg_tys) [] -- No labelled fields tyvars [] -- No existential type variables @@ -329,6 +325,7 @@ unboxedPairDataCon :: DataCon unboxedPairDataCon = tupleCon Unboxed 2 \end{code} + %************************************************************************ %* * \subsection[TysWiredIn-boxed-prim]{The ``boxed primitive'' types (@Char@, @Int@, etc)} @@ -536,11 +533,17 @@ done by enumeration\srcloc{lib/prelude/InTup?.hs}. \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} %************************************************************************