import Constants ( mAX_TUPLE_SIZE )
import Module ( Module, mkPrelModule )
import Name ( mkWiredInTyConName, mkWiredInIdName, nameOccName )
-import OccName ( mkSrcOccFS, tcName, dataName, mkWorkerOcc, mkGenOcc1, mkGenOcc2 )
+import OccName ( mkOccFS, tcName, dataName, mkWorkerOcc, mkGenOcc1, mkGenOcc2 )
import RdrName ( RdrName, mkPreludeQual, rdrNameOcc, rdrNameModule )
import DataCon ( DataCon, StrictnessMark(..), mkDataCon, dataConId )
import Var ( TyVar, tyVarKind )
TauType, ClassContext )
import Unique ( incrUnique, mkTupleTyConUnique, mkTupleDataConUnique )
import PrelNames
-import CmdLineOpts ( opt_GlasgowExts )
+import CmdLineOpts ( DynFlags, dopt_GlasgowExts )
import Array
import Maybe ( fromJust )
import FiniteMap ( lookupFM )
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 (mkSrcOccFS tcName name_str) tycon
+ tc_name = mkWiredInTyConName tc_uniq mod (mkOccFS tcName name_str) tycon
tc_kind = mkArrowKinds (map tyVarKind tyvars) res_kind
res_kind | isBoxed boxity = boxedTypeKind
| otherwise = unboxedTypeKind
being the )
\begin{code}
-isFFIArgumentTy :: Bool -> Type -> Bool
+isFFIArgumentTy :: DynFlags -> Bool -> Type -> Bool
-- Checks for valid argument type for a 'foreign import'
-isFFIArgumentTy is_safe ty = checkRepTyCon (legalOutgoingTyCon is_safe) ty
+isFFIArgumentTy dflags is_safe ty
+ = checkRepTyCon (legalOutgoingTyCon dflags is_safe) ty
isFFIExternalTy :: Type -> Bool
-- Types that are allowed as arguments of a 'foreign export'
-- bytearrays from a _ccall_ / foreign declaration
-- (or be passed them as arguments in foreign exported functions).
legalIncomingTyCon tc
- | getUnique tc `elem` [ foreignObjTyConKey, byteArrayTyConKey, mutableByteArrayTyConKey ]
+ | getUnique tc `elem` [ foreignObjTyConKey, 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 :: Bool -> TyCon -> Bool
+legalOutgoingTyCon :: DynFlags -> Bool -> 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 be_safe tc
+legalOutgoingTyCon dflags be_safe tc
| be_safe && getUnique tc `elem` [byteArrayTyConKey, mutableByteArrayTyConKey]
= False
| otherwise
- = marshalableTyCon tc
+ = marshalableTyCon dflags tc
-marshalableTyCon tc
- = (opt_GlasgowExts && isUnLiftedTyCon tc)
+marshalableTyCon dflags tc
+ = (dopt_GlasgowExts dflags && isUnLiftedTyCon tc)
|| boxedMarshalableTyCon tc
boxedMarshalableTyCon tc