addrDataCon,
addrTy,
addrTyCon,
+ ptrDataCon,
+ ptrTy,
+ ptrTyCon,
+ funPtrDataCon,
+ funPtrTy,
+ funPtrTyCon,
boolTy,
boolTyCon,
charDataCon,
consDataCon,
doubleDataCon,
doubleTy,
- isDoubleTy,
doubleTyCon,
falseDataCon, falseDataConId,
floatDataCon,
floatTy,
- isFloatTy,
floatTyCon,
intDataCon,
intTy,
intTyCon,
- isIntTy,
integerTy,
integerTyCon,
smallIntegerDataCon,
largeIntegerDataCon,
- isIntegerTy,
listTyCon,
wordTy,
wordTyCon,
- isFFIArgumentTy, -- :: Bool -> Type -> Bool
- isFFIResultTy, -- :: Type -> Bool
- isFFIExternalTy, -- :: Type -> Bool
- isFFIDynArgumentTy, -- :: Type -> Bool
- isFFIDynResultTy, -- :: Type -> Bool
- isFFILabelTy, -- :: Type -> Bool
- isAddrTy, -- :: Type -> Bool
- isForeignObjTy -- :: Type -> Bool
-
+ 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
#include "HsVersions.h"
import TysPrim
-- others:
+import ForeignCall ( Safety, playSafe )
import Constants ( mAX_TUPLE_SIZE )
-import Module ( Module, mkPrelModule )
-import Name ( mkWiredInTyConName, mkWiredInIdName, nameOccName )
+import Module ( mkPrelModule )
+import Name ( Name, nameRdrName, nameUnique, nameOccName,
+ nameModule, mkWiredInName )
import OccName ( mkOccFS, tcName, dataName, mkWorkerOcc, mkGenOcc1, mkGenOcc2 )
-import RdrName ( RdrName, mkPreludeQual, rdrNameOcc, rdrNameModule )
-import DataCon ( DataCon, StrictnessMark(..), mkDataCon, dataConId )
+import RdrName ( rdrNameOcc )
+import DataCon ( DataCon, mkDataCon, dataConId )
import Var ( TyVar, tyVarKind )
-import TyCon ( TyCon, AlgTyConFlavour(..), ArgVrcs, tyConDataCons,
- mkSynTyCon, mkTupleTyCon,
- isUnLiftedTyCon, mkAlgTyConRep,tyConName
+import TyCon ( TyCon, AlgTyConFlavour(..), tyConDataCons,
+ mkTupleTyCon, isUnLiftedTyCon, mkAlgTyCon
)
-import BasicTypes ( Arity, RecFlag(..), EP(..), Boxity(..), isBoxed )
+import BasicTypes ( Arity, RecFlag(..), Boxity(..), isBoxed, StrictnessMark(..) )
-import Type ( Type, mkTyConTy, mkTyConApp, mkSigmaTy, mkTyVarTys,
- mkArrowKinds, boxedTypeKind, unboxedTypeKind,
- mkFunTy, mkFunTys,
- splitTyConApp_maybe, repType, mkTyVarTy,
- TauType, ClassContext )
+import Type ( Type, mkTyConTy, mkTyConApp, mkTyVarTys,
+ mkArrowKinds, liftedTypeKind, unliftedTypeKind,
+ splitTyConApp_maybe,
+ TauType, ThetaType )
import Unique ( incrUnique, mkTupleTyConUnique, mkTupleDataConUnique )
import PrelNames
-import CmdLineOpts ( DynFlags, dopt_GlasgowExts )
+import CmdLineOpts
import Array
-import Maybe ( fromJust )
-import FiniteMap ( lookupFM )
alpha_tyvar = [alphaTyVar]
alpha_ty = [alphaTy]
data_tycons = genericTyCons ++
[ addrTyCon
+ , ptrTyCon
+ , funPtrTyCon
, boolTyCon
, charTyCon
, doubleTyCon
genericTyCons = [ plusTyCon, crossTyCon, genUnitTyCon ]
-tuple_tycons = unitTyCon : [tupleTyCon Boxed i | i <- [2..37] ]
-unboxed_tuple_tycons = [tupleTyCon Unboxed i | i <- [1..37] ]
+tuple_tycons = unitTyCon : [tupleTyCon Boxed i | i <- [2..mAX_TUPLE_SIZE] ]
+unboxed_tuple_tycons = [tupleTyCon Unboxed i | i <- [1..mAX_TUPLE_SIZE] ]
\end{code}
pcNonRecDataTyCon = pcTyCon DataTyCon NonRecursive
pcRecDataTyCon = pcTyCon DataTyCon Recursive
-pcTyCon new_or_data is_rec key rdr_name tyvars argvrcs cons
+pcTyCon new_or_data is_rec name tyvars argvrcs cons
= tycon
where
- tycon = mkAlgTyConRep name kind
+ tycon = mkAlgTyCon name kind
tyvars
[] -- No context
argvrcs
cons
- (length cons)
- [] -- No derivings
+ (length cons)
+ [] -- No record selectors
new_or_data
is_rec
gen_info
- mod = mkPrelModule (rdrNameModule rdr_name)
- occ = rdrNameOcc rdr_name
- name = mkWiredInTyConName key mod occ tycon
- kind = mkArrowKinds (map tyVarKind tyvars) boxedTypeKind
- gen_info = mk_tc_gen_info mod key name tycon
+ 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 :: Unique -- DataConKey
- -> RdrName -- Qualified
- -> [TyVar] -> ClassContext -> [TauType] -> TyCon -> DataCon
+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 wrap_key rdr_name tyvars context arg_tys tycon
+pcDataCon name tyvars context arg_tys tycon
= data_con
where
- mod = mkPrelModule (rdrNameModule rdr_name)
- wrap_occ = rdrNameOcc rdr_name
-
- data_con = mkDataCon wrap_name
+ data_con = mkDataCon name
[ NotMarkedStrict | a <- arg_tys ]
[ {- no labelled fields -} ]
tyvars context [] [] arg_tys tycon work_id wrap_id
- work_occ = mkWorkerOcc wrap_occ
- work_key = incrUnique wrap_key
- work_name = mkWiredInIdName work_key mod work_occ work_id
- work_id = mkDataConId work_name data_con
+ wrap_rdr = nameRdrName name
+ wrap_occ = rdrNameOcc wrap_rdr
- wrap_name = mkWiredInIdName wrap_key mod wrap_occ wrap_id
+ 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}
mk_tuple boxity arity = (tycon, tuple_con)
where
tycon = mkTupleTyCon tc_name tc_kind arity tyvars tuple_con boxity gen_info
- tc_name = mkWiredInTyConName tc_uniq mod (mkOccFS tcName name_str) tycon
+ tc_name = mkWiredInName mod (mkOccFS tcName name_str) tc_uniq
tc_kind = mkArrowKinds (map tyVarKind tyvars) res_kind
- res_kind | isBoxed boxity = boxedTypeKind
- | otherwise = unboxedTypeKind
+ res_kind | isBoxed boxity = liftedTypeKind
+ | otherwise = unliftedTypeKind
tyvars | isBoxed boxity = take arity alphaTyVars
| otherwise = take arity openAlphaTyVars
- tuple_con = pcDataCon dc_uniq rdr_name tyvars [] tyvar_tys tycon
+ tuple_con = pcDataCon name tyvars [] tyvar_tys tycon
tyvar_tys = mkTyVarTys tyvars
(mod_name, name_str) = mkTupNameStr boxity arity
- rdr_name = mkPreludeQual dataName mod_name name_str
+ 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
-mk_tc_gen_info mod tc_uniq tc_name tycon
- = gen_info
- 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 = mkWiredInIdName fn1_key mod occ_name1 id1
- name2 = mkWiredInIdName fn2_key mod occ_name2 id2
- gen_info = mkTyConGenInfo tycon name1 name2
- Just (EP id1 id2) = gen_info
-
unitTyCon = tupleTyCon Boxed 0
unitDataConId = dataConId (head (tyConDataCons unitTyCon))
--
-- data Void = -- No constructors!
--
--- ) It's boxed; there is only one value of this
+-- ) 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'
\begin{code}
charTy = mkTyConTy charTyCon
-charTyCon = pcNonRecDataTyCon charTyConKey charTyCon_RDR [] [] [charDataCon]
-charDataCon = pcDataCon charDataConKey charDataCon_RDR [] [] [charPrimTy] charTyCon
+charTyCon = pcNonRecDataTyCon charTyConName [] [] [charDataCon]
+charDataCon = pcDataCon charDataConName [] [] [charPrimTy] charTyCon
stringTy = mkListTy charTy -- convenience only
\end{code}
\begin{code}
intTy = mkTyConTy intTyCon
-intTyCon = pcNonRecDataTyCon intTyConKey intTyCon_RDR [] [] [intDataCon]
-intDataCon = pcDataCon intDataConKey mkInt_RDR [] [] [intPrimTy] intTyCon
-
-isIntTy :: Type -> Bool
-isIntTy = isTyCon intTyConKey
+intTyCon = pcNonRecDataTyCon intTyConName [] [] [intDataCon]
+intDataCon = pcDataCon intDataConName [] [] [intPrimTy] intTyCon
\end{code}
\begin{code}
-
wordTy = mkTyConTy wordTyCon
-wordTyCon = pcNonRecDataTyCon wordTyConKey wordTyCon_RDR [] [] [wordDataCon]
-wordDataCon = pcDataCon wordDataConKey wordDataCon_RDR [] [] [wordPrimTy] wordTyCon
+wordTyCon = pcNonRecDataTyCon wordTyConName [] [] [wordDataCon]
+wordDataCon = pcDataCon wordDataConName [] [] [wordPrimTy] wordTyCon
\end{code}
\begin{code}
addrTy = mkTyConTy addrTyCon
-addrTyCon = pcNonRecDataTyCon addrTyConKey addrTyCon_RDR [] [] [addrDataCon]
-addrDataCon = pcDataCon addrDataConKey addrDataCon_RDR [] [] [addrPrimTy] addrTyCon
+addrTyCon = pcNonRecDataTyCon addrTyConName [] [] [addrDataCon]
+addrDataCon = pcDataCon addrDataConName [] [] [addrPrimTy] addrTyCon
+\end{code}
+
+\begin{code}
+ptrTy = mkTyConTy ptrTyCon
-isAddrTy :: Type -> Bool
-isAddrTy = isTyCon addrTyConKey
+ptrTyCon = pcNonRecDataTyCon ptrTyConName alpha_tyvar [(True,False)] [ptrDataCon]
+ptrDataCon = pcDataCon ptrDataConName alpha_tyvar [] [addrPrimTy] ptrTyCon
\end{code}
\begin{code}
-floatTy = mkTyConTy floatTyCon
+funPtrTy = mkTyConTy funPtrTyCon
+
+funPtrTyCon = pcNonRecDataTyCon funPtrTyConName alpha_tyvar [(True,False)] [funPtrDataCon]
+funPtrDataCon = pcDataCon funPtrDataConName alpha_tyvar [] [addrPrimTy] funPtrTyCon
+\end{code}
-floatTyCon = pcNonRecDataTyCon floatTyConKey floatTyCon_RDR [] [] [floatDataCon]
-floatDataCon = pcDataCon floatDataConKey floatDataCon_RDR [] [] [floatPrimTy] floatTyCon
+\begin{code}
+floatTy = mkTyConTy floatTyCon
-isFloatTy :: Type -> Bool
-isFloatTy = isTyCon floatTyConKey
+floatTyCon = pcNonRecDataTyCon floatTyConName [] [] [floatDataCon]
+floatDataCon = pcDataCon floatDataConName [] [] [floatPrimTy] floatTyCon
\end{code}
\begin{code}
doubleTy = mkTyConTy doubleTyCon
-isDoubleTy :: Type -> Bool
-isDoubleTy = isTyCon doubleTyConKey
-
-doubleTyCon = pcNonRecDataTyCon doubleTyConKey doubleTyCon_RDR [] [] [doubleDataCon]
-doubleDataCon = pcDataCon doubleDataConKey doubleDataCon_RDR [] [] [doublePrimTy] doubleTyCon
+doubleTyCon = pcNonRecDataTyCon doubleTyConName [] [] [doubleDataCon]
+doubleDataCon = pcDataCon doubleDataConName [] [] [doublePrimTy] doubleTyCon
\end{code}
\begin{code}
stablePtrTyCon
- = pcNonRecDataTyCon stablePtrTyConKey stablePtrTyCon_RDR
+ = pcNonRecDataTyCon stablePtrTyConName
alpha_tyvar [(True,False)] [stablePtrDataCon]
where
stablePtrDataCon
- = pcDataCon stablePtrDataConKey stablePtrDataCon_RDR
+ = pcDataCon stablePtrDataConName
alpha_tyvar [] [mkStablePtrPrimTy alphaTy] stablePtrTyCon
\end{code}
\begin{code}
foreignObjTyCon
- = pcNonRecDataTyCon foreignObjTyConKey foreignObjTyCon_RDR
+ = pcNonRecDataTyCon foreignObjTyConName
[] [] [foreignObjDataCon]
where
foreignObjDataCon
- = pcDataCon foreignObjDataConKey foreignObjDataCon_RDR
+ = pcDataCon foreignObjDataConName
[] [] [foreignObjPrimTy] foreignObjTyCon
+\end{code}
-isForeignObjTy :: Type -> Bool
-isForeignObjTy = isTyCon foreignObjTyConKey
+\begin{code}
+foreignPtrTyCon
+ = pcNonRecDataTyCon foreignPtrTyConName
+ alpha_tyvar [(True,False)] [foreignPtrDataCon]
+ where
+ foreignPtrDataCon
+ = pcDataCon foreignPtrDataConName
+ alpha_tyvar [] [foreignObjPrimTy] foreignPtrTyCon
\end{code}
%************************************************************************
integerTy :: Type
integerTy = mkTyConTy integerTyCon
-integerTyCon = pcNonRecDataTyCon integerTyConKey integerTyCon_RDR
+integerTyCon = pcNonRecDataTyCon integerTyConName
[] [] [smallIntegerDataCon, largeIntegerDataCon]
-smallIntegerDataCon = pcDataCon smallIntegerDataConKey smallIntegerDataCon_RDR
+smallIntegerDataCon = pcDataCon smallIntegerDataConName
[] [] [intPrimTy] integerTyCon
-largeIntegerDataCon = pcDataCon largeIntegerDataConKey largeIntegerDataCon_RDR
+largeIntegerDataCon = pcDataCon largeIntegerDataConName
[] [] [intPrimTy, byteArrayPrimTy] integerTyCon
-
-
-isIntegerTy :: Type -> Bool
-isIntegerTy = isTyCon integerTyConKey
\end{code}
being the )
\begin{code}
-isFFIArgumentTy :: DynFlags -> Bool -> Type -> Bool
+isFFIArgumentTy :: DynFlags -> Safety -> Type -> Bool
-- Checks for valid argument type for a 'foreign import'
-isFFIArgumentTy dflags is_safe ty
- = checkRepTyCon (legalOutgoingTyCon dflags is_safe) ty
+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 legalIncomingTyCon ty
+isFFIExternalTy ty = checkRepTyCon legalFEArgTyCon ty
-isFFIResultTy :: Type -> Bool
--- Types that are allowed as a result of a 'foreign import' or of a 'foreign export'
--- Maybe we should distinguish between import and export, but
--- here we just choose the more restrictive 'incoming' predicate
--- But we allow () as well
-isFFIResultTy ty = checkRepTyCon (\tc -> tc == unitTyCon || legalIncomingTyCon tc) 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 either Addr, or
--- a newtype of Addr.
-isFFIDynArgumentTy = checkRepTyCon (== addrTyCon)
+-- 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 either Addr, or
--- a newtype of Addr.
-isFFIDynResultTy = checkRepTyCon (== addrTyCon)
+-- 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 either Addr, or
--- a newtype of Addr.
-isFFILabelTy = checkRepTyCon (== addrTyCon)
+-- 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 = checkTyCon check_tc (repType ty)
-
-checkTyCon :: (TyCon -> Bool) -> Type -> Bool
-checkTyCon check_tc ty = case splitTyConApp_maybe ty of
+ -- Look through newtypes
+checkRepTyCon check_tc ty = case splitTyConApp_maybe ty of
Just (tycon, _) -> check_tc tycon
Nothing -> False
-
-isTyCon :: Unique -> Type -> Bool
-isTyCon uniq ty = checkTyCon (\tc -> uniq == getUnique tc) ty
\end{code}
----------------------------------------------
----------------------------------------------
\begin{code}
-legalIncomingTyCon :: TyCon -> Bool
+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).
-legalIncomingTyCon tc
- | getUnique tc `elem` [ foreignObjTyConKey, byteArrayTyConKey,
- mutableByteArrayTyConKey ]
+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
-legalOutgoingTyCon :: DynFlags -> Bool -> TyCon -> Bool
+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
--- The boolean is true for a 'safe' call (when we don't want to
--- pass Haskell pointers to the world)
-legalOutgoingTyCon dflags be_safe tc
- | be_safe && getUnique tc `elem` [byteArrayTyConKey, mutableByteArrayTyConKey]
+legalOutgoingTyCon dflags safety tc
+ | playSafe safety && getUnique tc `elem` [byteArrayTyConKey, mutableByteArrayTyConKey]
= False
| otherwise
= marshalableTyCon dflags tc
marshalableTyCon dflags tc
- = (dopt_GlasgowExts dflags && isUnLiftedTyCon tc)
+ = (dopt Opt_GlasgowExts dflags && isUnLiftedTyCon tc)
|| boxedMarshalableTyCon tc
boxedMarshalableTyCon tc
- = getUnique tc `elem` [ intTyConKey, int8TyConKey, int16TyConKey, int32TyConKey, int64TyConKey
- , wordTyConKey, word8TyConKey, word16TyConKey, word32TyConKey, word64TyConKey
+ = getUnique tc `elem` [ intTyConKey, int8TyConKey, int16TyConKey
+ , int32TyConKey, int64TyConKey
+ , wordTyConKey, word8TyConKey, word16TyConKey
+ , word32TyConKey, word64TyConKey
, floatTyConKey, doubleTyConKey
- , addrTyConKey, charTyConKey, foreignObjTyConKey
+ , addrTyConKey, ptrTyConKey, funPtrTyConKey
+ , charTyConKey, foreignObjTyConKey
+ , foreignPtrTyConKey
, stablePtrTyConKey
, byteArrayTyConKey, mutableByteArrayTyConKey
, boolTyConKey
\begin{code}
boolTy = mkTyConTy boolTyCon
-boolTyCon = pcTyCon EnumTyCon NonRecursive boolTyConKey
- boolTyCon_RDR [] [] [falseDataCon, trueDataCon]
+boolTyCon = pcTyCon EnumTyCon NonRecursive boolTyConName
+ [] [] [falseDataCon, trueDataCon]
-falseDataCon = pcDataCon falseDataConKey false_RDR [] [] [] boolTyCon
-trueDataCon = pcDataCon trueDataConKey true_RDR [] [] [] boolTyCon
+falseDataCon = pcDataCon falseDataConName [] [] [] boolTyCon
+trueDataCon = pcDataCon trueDataConName [] [] [] boolTyCon
falseDataConId = dataConId falseDataCon
trueDataConId = dataConId trueDataCon
mkListTy :: Type -> Type
mkListTy ty = mkTyConApp listTyCon [ty]
-alphaListTy = mkSigmaTy alpha_tyvar [] (mkTyConApp listTyCon alpha_ty)
-
-listTyCon = pcRecDataTyCon listTyConKey listTyCon_RDR
+listTyCon = pcRecDataTyCon listTyConName
alpha_tyvar [(True,False)] [nilDataCon, consDataCon]
-nilDataCon = pcDataCon nilDataConKey nil_RDR alpha_tyvar [] [] listTyCon
-consDataCon = pcDataCon consDataConKey cons_RDR
- alpha_tyvar [] [alphaTy, mkTyConApp listTyCon alpha_ty] listTyCon
+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)
\begin{code}
crossTyCon :: TyCon
-crossTyCon = pcNonRecDataTyCon crossTyConKey crossTyCon_RDR alpha_beta_tyvars [] [crossDataCon]
+crossTyCon = pcNonRecDataTyCon crossTyConName alpha_beta_tyvars [] [crossDataCon]
crossDataCon :: DataCon
-crossDataCon = pcDataCon crossDataConKey crossDataCon_RDR alpha_beta_tyvars [] [alphaTy, betaTy] crossTyCon
+crossDataCon = pcDataCon crossDataConName alpha_beta_tyvars [] [alphaTy, betaTy] crossTyCon
plusTyCon :: TyCon
-plusTyCon = pcNonRecDataTyCon plusTyConKey plusTyCon_RDR alpha_beta_tyvars [] [inlDataCon, inrDataCon]
+plusTyCon = pcNonRecDataTyCon plusTyConName alpha_beta_tyvars [] [inlDataCon, inrDataCon]
inlDataCon, inrDataCon :: DataCon
-inlDataCon = pcDataCon inlDataConKey inlDataCon_RDR alpha_beta_tyvars [] [alphaTy] plusTyCon
-inrDataCon = pcDataCon inrDataConKey inrDataCon_RDR alpha_beta_tyvars [] [betaTy] plusTyCon
+inlDataCon = pcDataCon inlDataConName alpha_beta_tyvars [] [alphaTy] plusTyCon
+inrDataCon = pcDataCon inrDataConName alpha_beta_tyvars [] [betaTy] plusTyCon
genUnitTyCon :: TyCon -- The "1" type constructor for generics
-genUnitTyCon = pcNonRecDataTyCon genUnitTyConKey genUnitTyCon_RDR [] [] [genUnitDataCon]
+genUnitTyCon = pcNonRecDataTyCon genUnitTyConName [] [] [genUnitDataCon]
genUnitDataCon :: DataCon
-genUnitDataCon = pcDataCon genUnitDataConKey genUnitDataCon_RDR [] [] [] genUnitTyCon
+genUnitDataCon = pcDataCon genUnitDataConName [] [] [] genUnitTyCon
\end{code}
-
-
-
-
-