%
-% (c) The GRASP Project, Glasgow University, 1994-1995
+% (c) The GRASP Project, Glasgow University, 1994-1998
%
\section[TysWiredIn]{Wired-in knowledge about {\em non-primitive} types}
types and operations.''
\begin{code}
-#include "HsVersions.h"
-
module TysWiredIn (
+ wiredInTyCons, genericTyCons,
+
addrDataCon,
addrTy,
addrTyCon,
+ ptrDataCon,
+ ptrTy,
+ ptrTyCon,
+ funPtrDataCon,
+ funPtrTy,
+ funPtrTyCon,
boolTy,
boolTyCon,
charDataCon,
charTy,
charTyCon,
- cmpTagTy,
- cmpTagTyCon,
consDataCon,
doubleDataCon,
doubleTy,
doubleTyCon,
- eqPrimDataCon,
- falseDataCon,
+ falseDataCon, falseDataConId,
floatDataCon,
floatTy,
floatTyCon,
- getStatePairingConInfo,
- gtPrimDataCon,
+
intDataCon,
intTy,
intTyCon,
+
integerTy,
integerTyCon,
- integerDataCon,
- liftDataCon,
- liftTyCon,
+ smallIntegerDataCon,
+ largeIntegerDataCon,
+
listTyCon,
- ltPrimDataCon,
- mallocPtrTyCon,
- mkLiftTy,
+
mkListTy,
- mkPrimIoTy,
- mkStateTransformerTy,
- mkTupleTy,
nilDataCon,
- primIoTyCon,
- ratioDataCon,
- ratioTyCon,
- rationalTy,
- rationalTyCon,
- realWorldStateTy,
- return2GMPsTyCon,
- returnIntAndGMPTyCon,
- stTyCon,
+
+ -- tuples
+ mkTupleTy,
+ tupleTyCon, tupleCon,
+ unitTyCon, unitDataConId, pairTyCon,
+ unboxedSingletonTyCon, unboxedSingletonDataCon,
+ unboxedPairTyCon, unboxedPairDataCon,
+
+ -- Generics
+ genUnitTyCon, genUnitDataCon,
+ plusTyCon, inrDataCon, inlDataCon,
+ crossTyCon, crossDataCon,
+
stablePtrTyCon,
- stateAndAddrPrimTyCon,
- stateAndArrayPrimTyCon,
- stateAndByteArrayPrimTyCon,
- stateAndCharPrimTyCon,
- stateAndDoublePrimTyCon,
- stateAndFloatPrimTyCon,
- stateAndIntPrimTyCon,
- stateAndMallocPtrPrimTyCon,
- stateAndMutableArrayPrimTyCon,
- stateAndMutableByteArrayPrimTyCon,
- stateAndPtrPrimTyCon,
- stateAndStablePtrPrimTyCon,
- stateAndSynchVarPrimTyCon,
- stateAndWordPrimTyCon,
- stateDataCon,
- stateTyCon,
stringTy,
- stringTyCon,
- trueDataCon,
+ trueDataCon, trueDataConId,
unitTy,
+ voidTy,
wordDataCon,
wordTy,
- wordTyCon
+ wordTyCon,
+
+ isFFIArgumentTy, -- :: DynFlags -> Safety -> Type -> Bool
+ isFFIImportResultTy, -- :: DynFlags -> Type -> Bool
+ isFFIExportResultTy, -- :: Type -> Bool
+ isFFIExternalTy, -- :: Type -> Bool
+ isFFIDynArgumentTy, -- :: Type -> Bool
+ isFFIDynResultTy, -- :: Type -> Bool
+ isFFILabelTy, -- :: Type -> Bool
) where
-import Pretty --ToDo:rm debugging only
+#include "HsVersions.h"
+
+import {-# SOURCE #-} MkId( mkDataConId, mkDataConWrapId )
+import {-# SOURCE #-} Generics( mkTyConGenInfo )
-import PrelFuns -- help functions, types and things
+-- friends:
+import PrelNames
import TysPrim
-import AbsUniType ( applyTyCon, mkTupleTyCon, mkSynonymTyCon,
- getUniDataTyCon_maybe, mkSigmaTy, TyCon
- , pprUniType --ToDo: rm debugging only
- IF_ATTACK_PRAGMAS(COMMA cmpTyCon)
+-- others:
+import ForeignCall ( Safety, playSafe )
+import Constants ( mAX_TUPLE_SIZE )
+import Module ( mkPrelModule )
+import Name ( Name, nameRdrName, nameUnique, nameOccName,
+ nameModule, mkWiredInName )
+import OccName ( mkOccFS, tcName, dataName, mkWorkerOcc, mkGenOcc1, mkGenOcc2 )
+import RdrName ( rdrNameOcc )
+import DataCon ( DataCon, mkDataCon, dataConId )
+import Var ( TyVar, tyVarKind )
+import TyCon ( TyCon, AlgTyConFlavour(..), tyConDataCons,
+ mkTupleTyCon, isUnLiftedTyCon, mkAlgTyCon
)
-import IdInfo
-import Maybes ( Maybe(..) )
-import Unique
-import Util
+
+import BasicTypes ( Arity, RecFlag(..), Boxity(..), isBoxed, StrictnessMark(..) )
+
+import Type ( Type, mkTyConTy, mkTyConApp, mkTyVarTys,
+ mkArrowKinds, liftedTypeKind, unliftedTypeKind,
+ splitTyConApp_maybe,
+ TauType, ThetaType )
+import Unique ( incrUnique, mkTupleTyConUnique, mkTupleDataConUnique )
+import PrelNames
+import CmdLineOpts
+import Array
+
+alpha_tyvar = [alphaTyVar]
+alpha_ty = [alphaTy]
+alpha_beta_tyvars = [alphaTyVar, betaTyVar]
\end{code}
+
%************************************************************************
%* *
-\subsection[TysWiredIn-boxed-prim]{The ``boxed primitive'' types (@Char@, @Int@, etc)}
+\subsection{Wired in type constructors}
%* *
%************************************************************************
\begin{code}
-charTy = UniData charTyCon []
+wiredInTyCons :: [TyCon]
+wiredInTyCons = data_tycons ++ tuple_tycons ++ unboxed_tuple_tycons
+
+data_tycons = genericTyCons ++
+ [ addrTyCon
+ , ptrTyCon
+ , funPtrTyCon
+ , boolTyCon
+ , charTyCon
+ , doubleTyCon
+ , floatTyCon
+ , intTyCon
+ , integerTyCon
+ , listTyCon
+ , wordTyCon
+ ]
+
+genericTyCons :: [TyCon]
+genericTyCons = [ plusTyCon, crossTyCon, genUnitTyCon ]
+
+
+tuple_tycons = unitTyCon : [tupleTyCon Boxed i | i <- [2..mAX_TUPLE_SIZE] ]
+unboxed_tuple_tycons = [tupleTyCon Unboxed i | i <- [1..mAX_TUPLE_SIZE] ]
+\end{code}
+
+
+%************************************************************************
+%* *
+\subsection{mkWiredInTyCon}
+%* *
+%************************************************************************
+
+\begin{code}
+pcNonRecDataTyCon = pcTyCon DataTyCon NonRecursive
+pcRecDataTyCon = pcTyCon DataTyCon Recursive
-charTyCon = pcDataTyCon charTyConKey pRELUDE_BUILTIN SLIT("Char") [] [charDataCon]
-charDataCon = pcDataCon charDataConKey pRELUDE_BUILTIN SLIT("C#") [] [] [charPrimTy] charTyCon nullSpecEnv
+pcTyCon new_or_data is_rec name tyvars argvrcs cons
+ = tycon
+ where
+ tycon = mkAlgTyCon name kind
+ tyvars
+ [] -- No context
+ argvrcs
+ cons
+ (length cons)
+ [] -- No record selectors
+ new_or_data
+ is_rec
+ gen_info
+
+ mod = nameModule name
+ kind = mkArrowKinds (map tyVarKind tyvars) liftedTypeKind
+ gen_info = mk_tc_gen_info mod (nameUnique name) name tycon
+
+-- We generate names for the generic to/from Ids by incrementing
+-- the TyCon unique. So each Prelude tycon needs 3 slots, one
+-- for itself and two more for the generic Ids.
+mk_tc_gen_info mod tc_uniq tc_name tycon
+ = mkTyConGenInfo tycon [name1, name2]
+ where
+ tc_occ_name = nameOccName tc_name
+ occ_name1 = mkGenOcc1 tc_occ_name
+ occ_name2 = mkGenOcc2 tc_occ_name
+ fn1_key = incrUnique tc_uniq
+ fn2_key = incrUnique fn1_key
+ name1 = mkWiredInName mod occ_name1 fn1_key
+ name2 = mkWiredInName mod occ_name2 fn2_key
+
+pcDataCon :: Name -> [TyVar] -> ThetaType -> [TauType] -> TyCon -> DataCon
+-- The unique is the first of two free uniques;
+-- the first is used for the datacon itself and the worker;
+-- the second is used for the wrapper.
+
+pcDataCon name tyvars context arg_tys tycon
+ = data_con
+ where
+ data_con = mkDataCon name
+ [ NotMarkedStrict | a <- arg_tys ]
+ [ {- no labelled fields -} ]
+ tyvars context [] [] arg_tys tycon work_id wrap_id
+
+ wrap_rdr = nameRdrName name
+ wrap_occ = rdrNameOcc wrap_rdr
+
+ mod = nameModule name
+ wrap_id = mkDataConWrapId data_con
+
+ work_occ = mkWorkerOcc wrap_occ
+ work_key = incrUnique (nameUnique name)
+ work_name = mkWiredInName mod work_occ work_key
+ work_id = mkDataConId work_name data_con
\end{code}
+
+%************************************************************************
+%* *
+\subsection[TysWiredIn-tuples]{The tuple types}
+%* *
+%************************************************************************
+
\begin{code}
-intTy = UniData intTyCon []
+tupleTyCon :: Boxity -> Arity -> TyCon
+tupleTyCon boxity i | i > mAX_TUPLE_SIZE = fst (mk_tuple boxity i) -- Build one specially
+tupleTyCon Boxed i = fst (boxedTupleArr ! i)
+tupleTyCon Unboxed i = fst (unboxedTupleArr ! i)
+
+tupleCon :: Boxity -> Arity -> DataCon
+tupleCon boxity i | i > mAX_TUPLE_SIZE = snd (mk_tuple boxity i) -- Build one specially
+tupleCon Boxed i = snd (boxedTupleArr ! i)
+tupleCon Unboxed i = snd (unboxedTupleArr ! i)
+
+boxedTupleArr, unboxedTupleArr :: Array Int (TyCon,DataCon)
+boxedTupleArr = array (0,mAX_TUPLE_SIZE) [(i,mk_tuple Boxed i) | i <- [0..mAX_TUPLE_SIZE]]
+unboxedTupleArr = array (0,mAX_TUPLE_SIZE) [(i,mk_tuple Unboxed i) | i <- [0..mAX_TUPLE_SIZE]]
+
+mk_tuple :: Boxity -> Int -> (TyCon,DataCon)
+mk_tuple boxity arity = (tycon, tuple_con)
+ where
+ tycon = mkTupleTyCon tc_name tc_kind arity tyvars tuple_con boxity gen_info
+ tc_name = mkWiredInName mod (mkOccFS tcName name_str) tc_uniq
+ tc_kind = mkArrowKinds (map tyVarKind tyvars) res_kind
+ res_kind | isBoxed boxity = liftedTypeKind
+ | otherwise = unliftedTypeKind
+
+ tyvars | isBoxed boxity = take arity alphaTyVars
+ | otherwise = take arity openAlphaTyVars
+
+ tuple_con = pcDataCon name tyvars [] tyvar_tys tycon
+ tyvar_tys = mkTyVarTys tyvars
+ (mod_name, name_str) = mkTupNameStr boxity arity
+ name = mkWiredInName mod (mkOccFS dataName name_str) dc_uniq
+ tc_uniq = mkTupleTyConUnique boxity arity
+ dc_uniq = mkTupleDataConUnique boxity arity
+ mod = mkPrelModule mod_name
+ gen_info = mk_tc_gen_info mod tc_uniq tc_name tycon
+
+unitTyCon = tupleTyCon Boxed 0
+unitDataConId = dataConId (head (tyConDataCons unitTyCon))
+
+pairTyCon = tupleTyCon Boxed 2
+
+unboxedSingletonTyCon = tupleTyCon Unboxed 1
+unboxedSingletonDataCon = tupleCon Unboxed 1
+
+unboxedPairTyCon = tupleTyCon Unboxed 2
+unboxedPairDataCon = tupleCon Unboxed 2
+\end{code}
-intTyCon = pcDataTyCon intTyConKey pRELUDE_BUILTIN SLIT("Int") [] [intDataCon]
-intDataCon = pcDataCon intDataConKey pRELUDE_BUILTIN SLIT("I#") [] [] [intPrimTy] intTyCon nullSpecEnv
+%************************************************************************
+%* *
+\subsection[TysWiredIn-boxed-prim]{The ``boxed primitive'' types (@Char@, @Int@, etc)}
+%* *
+%************************************************************************
+
+\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 lifted; there is only one value of this
+-- type, namely "void", whose semantics is just bottom.
+--
+-- Haskell 98 drops the definition of a Void type, so we just 'simulate'
+-- voidTy using ().
+voidTy = unitTy
\end{code}
+
\begin{code}
-wordTy = UniData wordTyCon []
+charTy = mkTyConTy charTyCon
+
+charTyCon = pcNonRecDataTyCon charTyConName [] [] [charDataCon]
+charDataCon = pcDataCon charDataConName [] [] [charPrimTy] charTyCon
-wordTyCon = pcDataTyCon wordTyConKey pRELUDE_BUILTIN SLIT("_Word") [] [wordDataCon]
-wordDataCon = pcDataCon wordDataConKey pRELUDE_BUILTIN SLIT("W#") [] [] [wordPrimTy] wordTyCon nullSpecEnv
+stringTy = mkListTy charTy -- convenience only
\end{code}
\begin{code}
-addrTy = UniData addrTyCon []
+intTy = mkTyConTy intTyCon
-addrTyCon = pcDataTyCon addrTyConKey pRELUDE_BUILTIN SLIT("_Addr") [] [addrDataCon]
-addrDataCon = pcDataCon addrDataConKey pRELUDE_BUILTIN SLIT("A#") [] [] [addrPrimTy] addrTyCon nullSpecEnv
+intTyCon = pcNonRecDataTyCon intTyConName [] [] [intDataCon]
+intDataCon = pcDataCon intDataConName [] [] [intPrimTy] intTyCon
\end{code}
\begin{code}
-floatTy = UniData floatTyCon []
+wordTy = mkTyConTy wordTyCon
-floatTyCon = pcDataTyCon floatTyConKey pRELUDE_BUILTIN SLIT("Float") [] [floatDataCon]
-floatDataCon = pcDataCon floatDataConKey pRELUDE_BUILTIN SLIT("F#") [] [] [floatPrimTy] floatTyCon nullSpecEnv
+wordTyCon = pcNonRecDataTyCon wordTyConName [] [] [wordDataCon]
+wordDataCon = pcDataCon wordDataConName [] [] [wordPrimTy] wordTyCon
\end{code}
\begin{code}
-doubleTy = UniData doubleTyCon []
+addrTy = mkTyConTy addrTyCon
-doubleTyCon = pcDataTyCon doubleTyConKey pRELUDE_BUILTIN SLIT("Double") [] [doubleDataCon]
-doubleDataCon = pcDataCon doubleDataConKey pRELUDE_BUILTIN SLIT("D#") [] [] [doublePrimTy] doubleTyCon nullSpecEnv
+addrTyCon = pcNonRecDataTyCon addrTyConName [] [] [addrDataCon]
+addrDataCon = pcDataCon addrDataConName [] [] [addrPrimTy] addrTyCon
\end{code}
\begin{code}
-mkStateTy ty = applyTyCon stateTyCon [ty]
-realWorldStateTy = mkStateTy realWorldTy -- a common use
+ptrTy = mkTyConTy ptrTyCon
-stateTyCon = pcDataTyCon stateTyConKey pRELUDE_BUILTIN SLIT("_State") [alpha_tv] [stateDataCon]
-stateDataCon
- = pcDataCon stateDataConKey pRELUDE_BUILTIN SLIT("S#")
- [alpha_tv] [] [mkStatePrimTy alpha] stateTyCon nullSpecEnv
+ptrTyCon = pcNonRecDataTyCon ptrTyConName alpha_tyvar [(True,False)] [ptrDataCon]
+ptrDataCon = pcDataCon ptrDataConName alpha_tyvar [] [addrPrimTy] ptrTyCon
\end{code}
\begin{code}
-{- OLD:
-byteArrayTyCon
- = pcDataTyCon byteArrayTyConKey pRELUDE_ARRAY SLIT("_ByteArray")
- [alpha_tv] [byteArrayDataCon]
-
-byteArrayDataCon
- = pcDataCon byteArrayDataConKey pRELUDE_ARRAY SLIT("_ByteArray")
- [alpha_tv] []
- [mkTupleTy 2 [alpha, alpha], byteArrayPrimTy]
- byteArrayTyCon nullSpecEnv
--}
+funPtrTy = mkTyConTy funPtrTyCon
+
+funPtrTyCon = pcNonRecDataTyCon funPtrTyConName alpha_tyvar [(True,False)] [funPtrDataCon]
+funPtrDataCon = pcDataCon funPtrDataConName alpha_tyvar [] [addrPrimTy] funPtrTyCon
\end{code}
\begin{code}
-{- OLD:
-mutableArrayTyCon
- = pcDataTyCon mutableArrayTyConKey gLASGOW_ST SLIT("_MutableArray")
- [alpha_tv, beta_tv, gamma_tv] [mutableArrayDataCon]
- where
- mutableArrayDataCon
- = pcDataCon mutableArrayDataConKey gLASGOW_ST SLIT("_MutableArray")
- [alpha_tv, beta_tv, gamma_tv] []
- [mkTupleTy 2 [beta, beta], applyTyCon mutableArrayPrimTyCon [alpha, gamma]]
- mutableArrayTyCon nullSpecEnv
--}
+floatTy = mkTyConTy floatTyCon
+
+floatTyCon = pcNonRecDataTyCon floatTyConName [] [] [floatDataCon]
+floatDataCon = pcDataCon floatDataConName [] [] [floatPrimTy] floatTyCon
\end{code}
\begin{code}
-{-
-mutableByteArrayTyCon
- = pcDataTyCon mutableByteArrayTyConKey gLASGOW_ST SLIT("_MutableByteArray")
- [alpha_tv, beta_tv] [mutableByteArrayDataCon]
-
-mutableByteArrayDataCon
- = pcDataCon mutableByteArrayDataConKey gLASGOW_ST SLIT("_MutableByteArray")
- [alpha_tv, beta_tv] []
- [mkTupleTy 2 [beta, beta], mkMutableByteArrayPrimTy alpha]
- mutableByteArrayTyCon nullSpecEnv
--}
+doubleTy = mkTyConTy doubleTyCon
+
+doubleTyCon = pcNonRecDataTyCon doubleTyConName [] [] [doubleDataCon]
+doubleDataCon = pcDataCon doubleDataConName [] [] [doublePrimTy] doubleTyCon
\end{code}
\begin{code}
stablePtrTyCon
- = pcDataTyCon stablePtrTyConKey gLASGOW_MISC SLIT("_StablePtr")
- [alpha_tv] [stablePtrDataCon]
+ = pcNonRecDataTyCon stablePtrTyConName
+ alpha_tyvar [(True,False)] [stablePtrDataCon]
where
stablePtrDataCon
- = pcDataCon stablePtrDataConKey gLASGOW_MISC SLIT("_StablePtr")
- [alpha_tv] [] [applyTyCon stablePtrPrimTyCon [alpha]] stablePtrTyCon nullSpecEnv
+ = pcDataCon stablePtrDataConName
+ alpha_tyvar [] [mkStablePtrPrimTy alphaTy] stablePtrTyCon
\end{code}
\begin{code}
-mallocPtrTyCon
- = pcDataTyCon mallocPtrTyConKey gLASGOW_MISC SLIT("_MallocPtr")
- [] [mallocPtrDataCon]
+foreignObjTyCon
+ = pcNonRecDataTyCon foreignObjTyConName
+ [] [] [foreignObjDataCon]
where
- mallocPtrDataCon
- = pcDataCon mallocPtrDataConKey gLASGOW_MISC SLIT("_MallocPtr")
- [] [] [applyTyCon mallocPtrPrimTyCon []] mallocPtrTyCon nullSpecEnv
+ foreignObjDataCon
+ = pcDataCon foreignObjDataConName
+ [] [] [foreignObjPrimTy] foreignObjTyCon
\end{code}
-%************************************************************************
-%* *
-\subsection[TysWiredIn-Integer]{@Integer@ and its related ``pairing'' types}
-%* *
-%************************************************************************
-
-@Integer@ and its pals are not really primitive. @Integer@ itself, first:
\begin{code}
-integerTy :: UniType
-integerTy = UniData integerTyCon []
-
-integerTyCon = pcDataTyCon integerTyConKey pRELUDE_BUILTIN SLIT("Integer") [] [integerDataCon]
-
-#ifndef DPH
-integerDataCon = pcDataCon integerDataConKey pRELUDE_BUILTIN SLIT("J#")
- [] [] [intPrimTy, intPrimTy, byteArrayPrimTy] integerTyCon nullSpecEnv
-#else
--- DPH: For the time being we implement Integers in the same way as Ints.
-integerDataCon = pcDataCon integerDataConKey pRELUDE_BUILTIN SLIT("J#")
- [] [] [intPrimTy] integerTyCon nullSpecEnv
-#endif {- Data Parallel Haskell -}
-\end{code}
-
-And the other pairing types:
-\begin{code}
-return2GMPsTyCon = pcDataTyCon return2GMPsTyConKey
- pRELUDE_BUILTIN SLIT("_Return2GMPs") [] [return2GMPsDataCon]
-
-return2GMPsDataCon
- = pcDataCon return2GMPsDataConKey pRELUDE_BUILTIN SLIT("_Return2GMPs") [] []
- [intPrimTy, intPrimTy, byteArrayPrimTy,
- intPrimTy, intPrimTy, byteArrayPrimTy] return2GMPsTyCon nullSpecEnv
-
-returnIntAndGMPTyCon = pcDataTyCon returnIntAndGMPTyConKey
- pRELUDE_BUILTIN SLIT("_ReturnIntAndGMP") [] [returnIntAndGMPDataCon]
-
-returnIntAndGMPDataCon
- = pcDataCon returnIntAndGMPDataConKey pRELUDE_BUILTIN SLIT("_ReturnIntAndGMP") [] []
- [intPrimTy, intPrimTy, intPrimTy, byteArrayPrimTy] returnIntAndGMPTyCon nullSpecEnv
+foreignPtrTyCon
+ = pcNonRecDataTyCon foreignPtrTyConName
+ alpha_tyvar [(True,False)] [foreignPtrDataCon]
+ where
+ foreignPtrDataCon
+ = pcDataCon foreignPtrDataConName
+ alpha_tyvar [] [foreignObjPrimTy] foreignPtrTyCon
\end{code}
%************************************************************************
%* *
-\subsection[TysWiredIn-state-pairing]{``State-pairing'' types}
+\subsection[TysWiredIn-Integer]{@Integer@ and its related ``pairing'' types}
%* *
%************************************************************************
-These boring types pair a \tr{State#} with another primitive type.
-They are not really primitive, so they are given here, not in
-\tr{TysPrim.lhs}.
-
-We fish one of these \tr{StateAnd<blah>#} things with
-@getStatePairingConInfo@ (given a little way down).
-
-\begin{code}
-stateAndPtrPrimTyCon
- = pcDataTyCon stateAndPtrPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndPtr#")
- [alpha_tv, beta_tv] [stateAndPtrPrimDataCon]
-stateAndPtrPrimDataCon
- = pcDataCon stateAndPtrPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndPtr#")
- [alpha_tv, beta_tv] [] [mkStatePrimTy alpha, beta]
- stateAndPtrPrimTyCon nullSpecEnv
-
-stateAndCharPrimTyCon
- = pcDataTyCon stateAndCharPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndChar#")
- [alpha_tv] [stateAndCharPrimDataCon]
-stateAndCharPrimDataCon
- = pcDataCon stateAndCharPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndChar#")
- [alpha_tv] [] [mkStatePrimTy alpha, charPrimTy]
- stateAndCharPrimTyCon nullSpecEnv
-
-stateAndIntPrimTyCon
- = pcDataTyCon stateAndIntPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndInt#")
- [alpha_tv] [stateAndIntPrimDataCon]
-stateAndIntPrimDataCon
- = pcDataCon stateAndIntPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndInt#")
- [alpha_tv] [] [mkStatePrimTy alpha, intPrimTy]
- stateAndIntPrimTyCon nullSpecEnv
-
-stateAndWordPrimTyCon
- = pcDataTyCon stateAndWordPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndWord#")
- [alpha_tv] [stateAndWordPrimDataCon]
-stateAndWordPrimDataCon
- = pcDataCon stateAndWordPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndWord#")
- [alpha_tv] [] [mkStatePrimTy alpha, wordPrimTy]
- stateAndWordPrimTyCon nullSpecEnv
-
-stateAndAddrPrimTyCon
- = pcDataTyCon stateAndAddrPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndAddr#")
- [alpha_tv] [stateAndAddrPrimDataCon]
-stateAndAddrPrimDataCon
- = pcDataCon stateAndAddrPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndAddr#")
- [alpha_tv] [] [mkStatePrimTy alpha, addrPrimTy]
- stateAndAddrPrimTyCon nullSpecEnv
-
-stateAndStablePtrPrimTyCon
- = pcDataTyCon stateAndStablePtrPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndStablePtr#")
- [alpha_tv, beta_tv] [stateAndStablePtrPrimDataCon]
-stateAndStablePtrPrimDataCon
- = pcDataCon stateAndStablePtrPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndStablePtr#")
- [alpha_tv, beta_tv] []
- [mkStatePrimTy alpha, applyTyCon stablePtrPrimTyCon [beta]]
- stateAndStablePtrPrimTyCon nullSpecEnv
-
-stateAndMallocPtrPrimTyCon
- = pcDataTyCon stateAndMallocPtrPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndMallocPtr#")
- [alpha_tv] [stateAndMallocPtrPrimDataCon]
-stateAndMallocPtrPrimDataCon
- = pcDataCon stateAndMallocPtrPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndMallocPtr#")
- [alpha_tv] []
- [mkStatePrimTy alpha, applyTyCon mallocPtrPrimTyCon []]
- stateAndMallocPtrPrimTyCon nullSpecEnv
-
-stateAndFloatPrimTyCon
- = pcDataTyCon stateAndFloatPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndFloat#")
- [alpha_tv] [stateAndFloatPrimDataCon]
-stateAndFloatPrimDataCon
- = pcDataCon stateAndFloatPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndFloat#")
- [alpha_tv] [] [mkStatePrimTy alpha, floatPrimTy]
- stateAndFloatPrimTyCon nullSpecEnv
-
-stateAndDoublePrimTyCon
- = pcDataTyCon stateAndDoublePrimTyConKey pRELUDE_BUILTIN SLIT("StateAndDouble#")
- [alpha_tv] [stateAndDoublePrimDataCon]
-stateAndDoublePrimDataCon
- = pcDataCon stateAndDoublePrimDataConKey pRELUDE_BUILTIN SLIT("StateAndDouble#")
- [alpha_tv] [] [mkStatePrimTy alpha, doublePrimTy]
- stateAndDoublePrimTyCon nullSpecEnv
-\end{code}
-
+@Integer@ and its pals are not really primitive. @Integer@ itself, first:
\begin{code}
-stateAndArrayPrimTyCon
- = pcDataTyCon stateAndArrayPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndArray#")
- [alpha_tv, beta_tv] [stateAndArrayPrimDataCon]
-stateAndArrayPrimDataCon
- = pcDataCon stateAndArrayPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndArray#")
- [alpha_tv, beta_tv] [] [mkStatePrimTy alpha, mkArrayPrimTy beta]
- stateAndArrayPrimTyCon nullSpecEnv
-
-stateAndMutableArrayPrimTyCon
- = pcDataTyCon stateAndMutableArrayPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndMutableArray#")
- [alpha_tv, beta_tv] [stateAndMutableArrayPrimDataCon]
-stateAndMutableArrayPrimDataCon
- = pcDataCon stateAndMutableArrayPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndMutableArray#")
- [alpha_tv, beta_tv] [] [mkStatePrimTy alpha, mkMutableArrayPrimTy alpha beta]
- stateAndMutableArrayPrimTyCon nullSpecEnv
-
-stateAndByteArrayPrimTyCon
- = pcDataTyCon stateAndByteArrayPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndByteArray#")
- [alpha_tv] [stateAndByteArrayPrimDataCon]
-stateAndByteArrayPrimDataCon
- = pcDataCon stateAndByteArrayPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndByteArray#")
- [alpha_tv] [] [mkStatePrimTy alpha, byteArrayPrimTy]
- stateAndByteArrayPrimTyCon nullSpecEnv
-
-stateAndMutableByteArrayPrimTyCon
- = pcDataTyCon stateAndMutableByteArrayPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndMutableByteArray#")
- [alpha_tv] [stateAndMutableByteArrayPrimDataCon]
-stateAndMutableByteArrayPrimDataCon
- = pcDataCon stateAndMutableByteArrayPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndMutableByteArray#")
- [alpha_tv] [] [mkStatePrimTy alpha, applyTyCon mutableByteArrayPrimTyCon [alpha]]
- stateAndMutableByteArrayPrimTyCon nullSpecEnv
-
-stateAndSynchVarPrimTyCon
- = pcDataTyCon stateAndSynchVarPrimTyConKey pRELUDE_BUILTIN SLIT("StateAndSynchVar#")
- [alpha_tv, beta_tv] [stateAndSynchVarPrimDataCon]
-stateAndSynchVarPrimDataCon
- = pcDataCon stateAndSynchVarPrimDataConKey pRELUDE_BUILTIN SLIT("StateAndSynchVar#")
- [alpha_tv, beta_tv] [] [mkStatePrimTy alpha, mkSynchVarPrimTy alpha beta]
- stateAndSynchVarPrimTyCon nullSpecEnv
-\end{code}
+integerTy :: Type
+integerTy = mkTyConTy integerTyCon
-The ccall-desugaring mechanism uses this function to figure out how to
-rebox the result. It's really a HACK, especially the part about
-how many types to drop from \tr{tys_applied}.
+integerTyCon = pcNonRecDataTyCon integerTyConName
+ [] [] [smallIntegerDataCon, largeIntegerDataCon]
-\begin{code}
-getStatePairingConInfo
- :: UniType -- primitive type
- -> (Id, -- state pair constructor for prim type
- UniType) -- type of state pair
-
-getStatePairingConInfo prim_ty
- = case (getUniDataTyCon_maybe prim_ty) of
- Nothing -> panic "getStatePairingConInfo:1"
- Just (prim_tycon, tys_applied, _) ->
- let
- (pair_con, pair_tycon, num_tys) = assoc "getStatePairingConInfo" tbl prim_tycon
- pair_ty = applyTyCon pair_tycon (realWorldTy : drop num_tys tys_applied)
- in
- (pair_con, pair_ty)
- where
- tbl = [
- (charPrimTyCon, (stateAndCharPrimDataCon, stateAndCharPrimTyCon, 0)),
- (intPrimTyCon, (stateAndIntPrimDataCon, stateAndIntPrimTyCon, 0)),
- (wordPrimTyCon, (stateAndWordPrimDataCon, stateAndWordPrimTyCon, 0)),
- (addrPrimTyCon, (stateAndAddrPrimDataCon, stateAndAddrPrimTyCon, 0)),
- (stablePtrPrimTyCon, (stateAndStablePtrPrimDataCon, stateAndStablePtrPrimTyCon, 0)),
- (mallocPtrPrimTyCon, (stateAndMallocPtrPrimDataCon, stateAndMallocPtrPrimTyCon, 0)),
- (floatPrimTyCon, (stateAndFloatPrimDataCon, stateAndFloatPrimTyCon, 0)),
- (doublePrimTyCon, (stateAndDoublePrimDataCon, stateAndDoublePrimTyCon, 0)),
- (arrayPrimTyCon, (stateAndArrayPrimDataCon, stateAndArrayPrimTyCon, 0)),
- (mutableArrayPrimTyCon, (stateAndMutableArrayPrimDataCon, stateAndMutableArrayPrimTyCon, 1)),
- (byteArrayPrimTyCon, (stateAndByteArrayPrimDataCon, stateAndByteArrayPrimTyCon, 0)),
- (mutableByteArrayPrimTyCon, (stateAndMutableByteArrayPrimDataCon, stateAndMutableByteArrayPrimTyCon, 1)),
- (synchVarPrimTyCon, (stateAndSynchVarPrimDataCon, stateAndSynchVarPrimTyCon, 1))
- -- (PtrPrimTyCon, (stateAndPtrPrimDataCon, stateAndPtrPrimTyCon, 0)),
- ]
+smallIntegerDataCon = pcDataCon smallIntegerDataConName
+ [] [] [intPrimTy] integerTyCon
+largeIntegerDataCon = pcDataCon largeIntegerDataConName
+ [] [] [intPrimTy, byteArrayPrimTy] integerTyCon
\end{code}
+
%************************************************************************
%* *
-\subsection[TysWiredIn-ST]{The basic @_ST@ state-transformer type}
+\subsection[TysWiredIn-ext-type]{External types}
%* *
%************************************************************************
-This is really just an ordinary synonym, except it is ABSTRACT.
+The compiler's foreign function interface supports the passing of a
+restricted set of types as arguments and results (the restricting factor
+being the )
\begin{code}
-mkStateTransformerTy s a = applyTyCon stTyCon [s, a]
-
-stTyCon
- = mkSynonymTyCon
- stTyConKey
- (mkPreludeCoreName gLASGOW_ST SLIT("_ST"))
- 2
- [alpha_tv, beta_tv]
- (mkStateTy alpha `UniFun` mkTupleTy 2 [beta, mkStateTy alpha])
- True -- ToDo: make... *** ABSTRACT ***
+isFFIArgumentTy :: DynFlags -> Safety -> Type -> Bool
+-- Checks for valid argument type for a 'foreign import'
+isFFIArgumentTy dflags safety ty
+ = checkRepTyCon (legalOutgoingTyCon dflags safety) ty
+
+isFFIExternalTy :: Type -> Bool
+-- Types that are allowed as arguments of a 'foreign export'
+isFFIExternalTy ty = checkRepTyCon legalFEArgTyCon ty
+
+isFFIImportResultTy :: DynFlags -> Type -> Bool
+isFFIImportResultTy dflags ty
+ = checkRepTyCon (legalFIResultTyCon dflags) ty
+
+isFFIExportResultTy :: Type -> Bool
+isFFIExportResultTy ty = checkRepTyCon legalFEResultTyCon ty
+
+isFFIDynArgumentTy :: Type -> Bool
+-- The argument type of a foreign import dynamic must be Ptr, FunPtr, Addr,
+-- or a newtype of either.
+isFFIDynArgumentTy = checkRepTyCon (\tc -> tc == ptrTyCon || tc == funPtrTyCon || tc == addrTyCon)
+
+isFFIDynResultTy :: Type -> Bool
+-- The result type of a foreign export dynamic must be Ptr, FunPtr, Addr,
+-- or a newtype of either.
+isFFIDynResultTy = checkRepTyCon (\tc -> tc == ptrTyCon || tc == funPtrTyCon || tc == addrTyCon)
+
+isFFILabelTy :: Type -> Bool
+-- The type of a foreign label must be Ptr, FunPtr, Addr,
+-- or a newtype of either.
+isFFILabelTy = checkRepTyCon (\tc -> tc == ptrTyCon || tc == funPtrTyCon || tc == addrTyCon)
+
+checkRepTyCon :: (TyCon -> Bool) -> Type -> Bool
+ -- Look through newtypes
+checkRepTyCon check_tc ty = case splitTyConApp_maybe ty of
+ Just (tycon, _) -> check_tc tycon
+ Nothing -> False
\end{code}
-%************************************************************************
-%* *
-\subsection[TysWiredIn-IO]{The @PrimIO@ and @IO@ monadic-I/O types}
-%* *
-%************************************************************************
-
-@PrimIO@ and @IO@ really are just a plain synonyms.
+----------------------------------------------
+These chaps do the work; they are not exported
+----------------------------------------------
\begin{code}
-mkPrimIoTy a = applyTyCon primIoTyCon [a]
-
-primIoTyCon
- = mkSynonymTyCon
- primIoTyConKey
- (mkPreludeCoreName pRELUDE_PRIMIO SLIT("PrimIO"))
- 1
- [alpha_tv]
- (mkStateTransformerTy realWorldTy alpha)
- True -- need not be abstract
+legalFEArgTyCon :: TyCon -> Bool
+-- It's illegal to return foreign objects and (mutable)
+-- bytearrays from a _ccall_ / foreign declaration
+-- (or be passed them as arguments in foreign exported functions).
+legalFEArgTyCon tc
+ | getUnique tc `elem` [ foreignObjTyConKey, foreignPtrTyConKey,
+ byteArrayTyConKey, mutableByteArrayTyConKey ]
+ = False
+ -- It's also illegal to make foreign exports that take unboxed
+ -- arguments. The RTS API currently can't invoke such things. --SDM 7/2000
+ | otherwise
+ = boxedMarshalableTyCon tc
+
+legalFIResultTyCon :: DynFlags -> TyCon -> Bool
+legalFIResultTyCon dflags tc
+ | getUnique tc `elem`
+ [ foreignObjTyConKey, foreignPtrTyConKey,
+ byteArrayTyConKey, mutableByteArrayTyConKey ] = False
+ | tc == unitTyCon = True
+ | otherwise = marshalableTyCon dflags tc
+
+legalFEResultTyCon :: TyCon -> Bool
+legalFEResultTyCon tc
+ | getUnique tc `elem`
+ [ foreignObjTyConKey, foreignPtrTyConKey,
+ byteArrayTyConKey, mutableByteArrayTyConKey ] = False
+ | tc == unitTyCon = True
+ | otherwise = boxedMarshalableTyCon tc
+
+legalOutgoingTyCon :: DynFlags -> Safety -> TyCon -> Bool
+-- Checks validity of types going from Haskell -> external world
+legalOutgoingTyCon dflags safety tc
+ | playSafe safety && getUnique tc `elem` [byteArrayTyConKey, mutableByteArrayTyConKey]
+ = False
+ | otherwise
+ = marshalableTyCon dflags tc
+
+marshalableTyCon dflags tc
+ = (dopt Opt_GlasgowExts dflags && isUnLiftedTyCon tc)
+ || boxedMarshalableTyCon tc
+
+boxedMarshalableTyCon tc
+ = getUnique tc `elem` [ intTyConKey, int8TyConKey, int16TyConKey
+ , int32TyConKey, int64TyConKey
+ , wordTyConKey, word8TyConKey, word16TyConKey
+ , word32TyConKey, word64TyConKey
+ , floatTyConKey, doubleTyConKey
+ , addrTyConKey, ptrTyConKey, funPtrTyConKey
+ , charTyConKey, foreignObjTyConKey
+ , foreignPtrTyConKey
+ , stablePtrTyConKey
+ , byteArrayTyConKey, mutableByteArrayTyConKey
+ , boolTyConKey
+ ]
\end{code}
+
%************************************************************************
%* *
\subsection[TysWiredIn-Bool]{The @Bool@ type}
{\em END IDLE SPECULATION BY SIMON}
\begin{code}
-boolTy = UniData boolTyCon []
-
-boolTyCon = pcDataTyCon boolTyConKey pRELUDE_CORE SLIT("Bool") [] [falseDataCon, trueDataCon]
-
-falseDataCon = pcDataCon falseDataConKey pRELUDE_CORE SLIT("False") [] [] [] boolTyCon nullSpecEnv
-trueDataCon = pcDataCon trueDataConKey pRELUDE_CORE SLIT("True") [] [] [] boolTyCon nullSpecEnv
-\end{code}
-
-%************************************************************************
-%* *
-\subsection[TysWiredIn-CMP-TAG]{The @CMP_TAG#@ type (for fast `derived' comparisons)}
-%* *
-%************************************************************************
-
-\begin{code}
----------------------------------------------
--- data _CMP_TAG = _LT | _EQ | _GT deriving ()
----------------------------------------------
+boolTy = mkTyConTy boolTyCon
-cmpTagTy = UniData cmpTagTyCon []
+boolTyCon = pcTyCon EnumTyCon NonRecursive boolTyConName
+ [] [] [falseDataCon, trueDataCon]
-cmpTagTyCon = pcDataTyCon cmpTagTyConKey pRELUDE_BUILTIN SLIT("_CMP_TAG") []
- [ltPrimDataCon, eqPrimDataCon, gtPrimDataCon]
+falseDataCon = pcDataCon falseDataConName [] [] [] boolTyCon
+trueDataCon = pcDataCon trueDataConName [] [] [] boolTyCon
-ltPrimDataCon = pcDataCon ltTagDataConKey pRELUDE_BUILTIN SLIT("_LT") [] [] [] cmpTagTyCon nullSpecEnv
-eqPrimDataCon = pcDataCon eqTagDataConKey pRELUDE_BUILTIN SLIT("_EQ") [] [] [] cmpTagTyCon nullSpecEnv
-gtPrimDataCon = pcDataCon gtTagDataConKey pRELUDE_BUILTIN SLIT("_GT") [] [] [] cmpTagTyCon nullSpecEnv
+falseDataConId = dataConId falseDataCon
+trueDataConId = dataConId trueDataCon
\end{code}
%************************************************************************
%************************************************************************
Special syntax, deeply wired in, but otherwise an ordinary algebraic
-data type:
+data types:
\begin{verbatim}
-data List a = Nil | a : (List a)
+data [] a = [] | a : (List a)
+data () = ()
+data (,) a b = (,,) a b
+...
\end{verbatim}
\begin{code}
-mkListTy :: UniType -> UniType
-mkListTy ty = UniData listTyCon [ty]
-
-alphaListTy = mkSigmaTy [alpha_tv] [] (mkListTy alpha)
-
-listTyCon = pcDataTyCon listTyConKey pRELUDE_BUILTIN SLIT("List") [alpha_tv] [nilDataCon, consDataCon]
-
-nilDataCon = pcDataCon nilDataConKey pRELUDE_BUILTIN SLIT("Nil") [alpha_tv] [] [] listTyCon
- (pcGenerateDataSpecs alphaListTy)
-consDataCon = pcDataCon consDataConKey pRELUDE_BUILTIN SLIT(":")
- [alpha_tv] [] [alpha, mkListTy alpha] listTyCon
- (pcGenerateDataSpecs alphaListTy)
-\end{code}
-
-This is the @_Build@ data constructor, it does {\em not} appear inside
-listTyCon. It has this type: \tr{((a -> b -> b) -> b -> b) -> [a]}.
-\begin{code}
-{- NOT USED:
-buildDataCon
- = pcDataCon buildDataConKey pRELUDE_BUILTIN "Build"
- [alpha_tv] [] [
- mkSigmaTy [beta_tv] []
- ((alpha `UniFun` (beta `UniFun` beta))
- `UniFun` (beta
- `UniFun` beta))] listTyCon nullSpecEnv
--}
+mkListTy :: Type -> Type
+mkListTy ty = mkTyConApp listTyCon [ty]
+
+listTyCon = pcRecDataTyCon listTyConName
+ alpha_tyvar [(True,False)] [nilDataCon, consDataCon]
+
+nilDataCon = pcDataCon nilDataConName alpha_tyvar [] [] listTyCon
+consDataCon = pcDataCon consDataConName
+ alpha_tyvar [] [alphaTy, mkTyConApp listTyCon alpha_ty] listTyCon
+-- Interesting: polymorphic recursion would help here.
+-- We can't use (mkListTy alphaTy) in the defn of consDataCon, else mkListTy
+-- gets the over-specific type (Type -> Type)
\end{code}
%************************************************************************
\begin{itemize}
\item
-They have a special family of type constructors, of type
-@TyCon@\srcloc{uniType/TyCon.lhs}.
+They have a special family of type constructors, of type @TyCon@
These contain the tycon arity, but don't require a Unique.
\item
They have a special family of constructors, of type
-@Id@\srcloc{basicTypes/Id.lhs}. Again these contain their arity but
-don't need a Unique.
+@Id@. Again these contain their arity but don't need a Unique.
\item
There should be a magic way of generating the info tables and
\end{itemize}
\begin{code}
-mkTupleTy :: Int -> [UniType] -> UniType
-
-mkTupleTy arity tys = applyTyCon (mkTupleTyCon arity) tys
+mkTupleTy :: Boxity -> Int -> [Type] -> Type
+mkTupleTy boxity arity tys = mkTyConApp (tupleTyCon boxity arity) tys
-unitTy = mkTupleTy 0 []
+unitTy = mkTupleTy Boxed 0 []
\end{code}
%************************************************************************
-%* *
-\subsection[TysWiredIn-Ratios]{@Ratio@ and @Rational@}
-%* *
+%* *
+\subsection{Wired In Type Constructors for Representation Types}
+%* *
%************************************************************************
-ToDo: make this (mostly) go away.
-
-\begin{code}
-rationalTy :: UniType
-
-mkRatioTy ty = UniData ratioTyCon [ty]
-rationalTy = mkRatioTy integerTy
+The following code defines the wired in datatypes cross, plus, unit
+and c_of needed for the generic methods.
-ratioTyCon = pcDataTyCon ratioTyConKey pRELUDE_RATIO SLIT("Ratio") [alpha_tv] [ratioDataCon]
-
-ratioDataCon = pcDataCon ratioDataConKey pRELUDE_RATIO SLIT(":%")
- [alpha_tv] [{-(integralClass,alpha)-}] [alpha, alpha] ratioTyCon nullSpecEnv
- -- context omitted to match lib/prelude/ defn of "data Ratio ..."
-
-rationalTyCon
- = mkSynonymTyCon
- rationalTyConKey
- (mkPreludeCoreName pRELUDE_RATIO SLIT("Rational"))
- 0 -- arity
- [] -- tyvars
- rationalTy -- == mkRatioTy integerTy
- True -- unabstract
-\end{code}
-
-%************************************************************************
-%* *
-\subsection[TysWiredIn-_Lift]{@_Lift@ type: to support array indexing}
-%* *
-%************************************************************************
-
-Again, deeply turgid: \tr{data _Lift a = _Lift a}.
+Ok, so the basic story is that for each type constructor I need to
+create 2 things - a TyCon and a DataCon and then we are basically
+ok. There are going to be no arguments passed to these functions
+because -well- there is nothing to pass to these functions.
\begin{code}
-mkLiftTy ty = applyTyCon liftTyCon [ty]
-
-{-
-mkLiftTy ty
- = mkSigmaTy tvs theta (UniData liftTyCon [tau])
- where
- (tvs, theta, tau) = splitType ty
+crossTyCon :: TyCon
+crossTyCon = pcNonRecDataTyCon crossTyConName alpha_beta_tyvars [] [crossDataCon]
-isLiftTy ty
- = case getUniDataTyCon_maybe tau of
- Just (tycon, tys, _) -> tycon == liftTyCon
- Nothing -> False
- where
- (tvs, theta, tau) = splitType ty
--}
+crossDataCon :: DataCon
+crossDataCon = pcDataCon crossDataConName alpha_beta_tyvars [] [alphaTy, betaTy] crossTyCon
+plusTyCon :: TyCon
+plusTyCon = pcNonRecDataTyCon plusTyConName alpha_beta_tyvars [] [inlDataCon, inrDataCon]
-alphaLiftTy = mkSigmaTy [alpha_tv] [] (UniData liftTyCon [alpha])
-
-liftTyCon
- = pcDataTyCon liftTyConKey pRELUDE_BUILTIN SLIT("_Lift") [alpha_tv] [liftDataCon]
-
-liftDataCon
- = pcDataCon liftDataConKey pRELUDE_BUILTIN SLIT("_Lift")
- [alpha_tv] [] [alpha] liftTyCon
- ((pcGenerateDataSpecs alphaLiftTy) `addOneToSpecEnv`
- (SpecInfo [Just realWorldStatePrimTy] 0 bottom))
- where
- bottom = panic "liftDataCon:State# _RealWorld"
-\end{code}
-
-
-%************************************************************************
-%* *
-\subsection[TysWiredIn-for-convenience]{Types wired in for convenience (e.g., @String@)}
-%* *
-%************************************************************************
-
-\begin{code}
-stringTy = mkListTy charTy
-
-stringTyCon
- = mkSynonymTyCon
- stringTyConKey
- (mkPreludeCoreName pRELUDE_CORE SLIT("String"))
- 0
- [] -- type variables
- stringTy
- True -- unabstract
-\end{code}
-
-\begin{code}
-{- UNUSED:
-packedStringTy = applyTyCon packedStringTyCon []
-
-packedStringTyCon
- = pcDataTyCon packedStringTyConKey pRELUDE_PS SLIT("_PackedString") []
- [psDataCon, cpsDataCon]
+inlDataCon, inrDataCon :: DataCon
+inlDataCon = pcDataCon inlDataConName alpha_beta_tyvars [] [alphaTy] plusTyCon
+inrDataCon = pcDataCon inrDataConName alpha_beta_tyvars [] [betaTy] plusTyCon
-psDataCon
- = pcDataCon psDataConKey pRELUDE_PS SLIT("_PS")
- [] [] [intPrimTy, byteArrayPrimTy] packedStringTyCon
+genUnitTyCon :: TyCon -- The "1" type constructor for generics
+genUnitTyCon = pcNonRecDataTyCon genUnitTyConName [] [] [genUnitDataCon]
-cpsDataCon
- = pcDataCon cpsDataConKey pRELUDE_PS SLIT("_CPS")
- [] [] [addrPrimTy] packedStringTyCon
--}
+genUnitDataCon :: DataCon
+genUnitDataCon = pcDataCon genUnitDataConName [] [] [] genUnitTyCon
\end{code}