intPrimTyConKey,
intTyConKey,
int8TyConKey,
- int8DataConKey,
int16TyConKey,
- int16DataConKey,
int32TyConKey,
- int32DataConKey,
- int64DataConKey,
int64PrimTyConKey,
int64TyConKey,
smallIntegerDataConKey,
wordPrimTyConKey,
wordTyConKey,
word8TyConKey,
- word8DataConKey,
word16TyConKey,
- word16DataConKey,
word32TyConKey,
- word32DataConKey,
- word64DataConKey,
word64PrimTyConKey,
word64TyConKey,
zipIdKey
falseDataConKey = mkPreludeDataConUnique 5
floatDataConKey = mkPreludeDataConUnique 6
intDataConKey = mkPreludeDataConUnique 7
-int8DataConKey = mkPreludeDataConUnique 8
-int16DataConKey = mkPreludeDataConUnique 9
-int32DataConKey = mkPreludeDataConUnique 10
-int64DataConKey = mkPreludeDataConUnique 11
smallIntegerDataConKey = mkPreludeDataConUnique 12
largeIntegerDataConKey = mkPreludeDataConUnique 13
foreignObjDataConKey = mkPreludeDataConUnique 14
stableNameDataConKey = mkPreludeDataConUnique 18
trueDataConKey = mkPreludeDataConUnique 34
wordDataConKey = mkPreludeDataConUnique 35
-word8DataConKey = mkPreludeDataConUnique 36
-word16DataConKey = mkPreludeDataConUnique 37
-word32DataConKey = mkPreludeDataConUnique 38
-word64DataConKey = mkPreludeDataConUnique 39
stDataConKey = mkPreludeDataConUnique 40
ioDataConKey = mkPreludeDataConUnique 42
\end{code}
-- that is all. If something is in here, you know that
-- if it's used at all then it's Name will be just as
-- it is here, unique and all. Includes all the
- -- wiredd-in names.
+ -- wired-in names.
thinAirIdNames, -- Names of non-wired-in Ids that may be used out of
setThinAirIds, -- thin air in any compilation. If they are not wired in
-- Random other things
main_NAME, ioTyCon_NAME,
deRefStablePtr_NAME, makeStablePtr_NAME,
- bindIO_NAME,
+ bindIO_NAME,
maybeCharLikeCon, maybeIntLikeCon,
needsDataDeclCtxtClassKeys, cCallishClassKeys, cCallishTyKeys,
, doubleTyCon
, floatTyCon
, intTyCon
- , int8TyCon
- , int16TyCon
- , int32TyCon
- , int64TyCon
, integerTyCon
, listTyCon
, wordTyCon
- , word8TyCon
- , word16TyCon
- , word32TyCon
- , word64TyCon
]
\end{code}
, (filter_RDR, filterIdKey)
, (zip_RDR, zipIdKey)
+ -- FFI primitive types that are not wired-in.
+ , (int8TyCon_RDR, int8TyConKey)
+ , (int16TyCon_RDR, int16TyConKey)
+ , (int32TyCon_RDR, int32TyConKey)
+ , (int64TyCon_RDR, int64TyConKey)
+ , (word8TyCon_RDR, word8TyConKey)
+ , (word16TyCon_RDR, word16TyConKey)
+ , (word32TyCon_RDR, word32TyConKey)
+ , (word64TyCon_RDR, word64TyConKey)
+
-- Others
, (otherwiseId_RDR, otherwiseIdKey)
, (assert_RDR, assertIdKey)
times_RDR = varQual pREL_BASE SLIT("*")
mkInt_RDR = dataQual pREL_BASE SLIT("I#")
+int8TyCon_RDR = tcQual iNT SLIT("Int8")
+int16TyCon_RDR = tcQual iNT SLIT("Int16")
+int32TyCon_RDR = tcQual iNT SLIT("Int32")
+int64TyCon_RDR = tcQual pREL_ADDR SLIT("Int64")
+
+word8TyCon_RDR = tcQual wORD SLIT("Word8")
+word16TyCon_RDR = tcQual wORD SLIT("Word16")
+word32TyCon_RDR = tcQual wORD SLIT("Word32")
+word64TyCon_RDR = tcQual pREL_ADDR SLIT("Word64")
+
error_RDR = varQual pREL_ERR SLIT("error")
assert_RDR = varQual pREL_GHC SLIT("assert")
assertErr_RDR = varQual pREL_ERR SLIT("assertError")
]
-- Renamer always imports these data decls replete with constructors
- -- so that desugarer can always see the constructor. Ugh!
+ -- so that desugarer can always see their constructors. Ugh!
cCallishTyKeys =
[ addrTyConKey
, wordTyConKey
, mutableByteArrayTyConKey
, foreignObjTyConKey
, stablePtrTyConKey
+ , int8TyConKey
+ , int16TyConKey
+ , int32TyConKey
+ , int64TyConKey
+ , word8TyConKey
+ , word16TyConKey
+ , word32TyConKey
+ , word64TyConKey
]
standardClassKeys
iNT, wORD :: Module
-iNT = mkPrelModule "Int"
-wORD = mkPrelModule "Word"
+iNT = mkSrcModule "Int"
+wORD = mkSrcModule "Word"
\end{code}
isIntTy,
inIntRange,
- int8TyCon,
- int16TyCon,
- int32TyCon,
-
- int64TyCon,
-
integerTy,
integerTyCon,
smallIntegerDataCon,
wordTy,
wordTyCon,
- word8TyCon,
- word16TyCon,
- word32TyCon,
- word64TyCon,
-
isFFIArgumentTy, -- :: Type -> Bool
isFFIResultTy, -- :: Type -> Bool
isFFIExternalTy, -- :: Type -> Bool
max_int = toInteger maxInt
min_int = toInteger minInt
-int8TyCon = pcNonRecDataTyCon int8TyConKey iNT SLIT("Int8") [] [int8DataCon]
- where
- int8DataCon = pcDataCon int8DataConKey iNT SLIT("I8#") [] [] [intPrimTy] int8TyCon
-
-int16TyCon = pcNonRecDataTyCon int16TyConKey iNT SLIT("Int16") [] [int16DataCon]
- where
- int16DataCon = pcDataCon int16DataConKey iNT SLIT("I16#") [] [] [intPrimTy] int16TyCon
-
-int32TyCon = pcNonRecDataTyCon int32TyConKey iNT SLIT("Int32") [] [int32DataCon]
- where
- int32DataCon = pcDataCon int32DataConKey iNT SLIT("I32#") [] [] [intPrimTy] int32TyCon
-
-int64TyCon = pcNonRecDataTyCon int64TyConKey pREL_ADDR SLIT("Int64") [] [int64DataCon]
- where
- int64DataCon = pcDataCon int64DataConKey pREL_ADDR SLIT("I64#") [] [] [int64PrimTy] int64TyCon
\end{code}
\begin{code}
wordTyCon = pcNonRecDataTyCon wordTyConKey pREL_ADDR SLIT("Word") [] [wordDataCon]
wordDataCon = pcDataCon wordDataConKey pREL_ADDR SLIT("W#") [] [] [wordPrimTy] wordTyCon
-
-word8TyCon = pcNonRecDataTyCon word8TyConKey wORD SLIT("Word8") [] [word8DataCon]
- where
- word8DataCon = pcDataCon word8DataConKey wORD SLIT("W8#") [] [] [wordPrimTy] word8TyCon
-
-word16TyCon = pcNonRecDataTyCon word16TyConKey wORD SLIT("Word16") [] [word16DataCon]
- where
- word16DataCon = pcDataCon word16DataConKey wORD SLIT("W16#") [] [] [wordPrimTy] word16TyCon
-
-word32TyCon = pcNonRecDataTyCon word32TyConKey wORD SLIT("Word32") [] [word32DataCon]
- where
- word32DataCon = pcDataCon word32DataConKey wORD SLIT("W32#") [] [] [wordPrimTy] word32TyCon
-
-word64TyCon = pcNonRecDataTyCon word64TyConKey pREL_ADDR SLIT("Word64") [] [word64DataCon]
- where
- word64DataCon = pcDataCon word64DataConKey pREL_ADDR SLIT("W64#") [] [] [word64PrimTy] word64TyCon
\end{code}
\begin{code}
-> IO (r, Bag ErrMsg, Bag WarnMsg)
initRn mod us dirs loc do_rn = do
+ (himap, hibmap) <- mkModuleHiMaps dirs
names_var <- sstToIO (newMutVarSST (us, emptyFM, builtins))
errs_var <- sstToIO (newMutVarSST (emptyBag,emptyBag))
iface_var <- sstToIO (newMutVarSST (emptyIfaces mod))
occs_var <- sstToIO (newMutVarSST initOccs)
- (himap, hibmap) <- mkModuleHiMaps dirs
let
rn_down = RnDown { rn_loc = loc, rn_omit = \n -> False, rn_ns = names_var,
rn_errs = errs_var, rn_occs = occs_var,
iDefData = emptyNameEnv,
iInstMods = []
}
-
builtins :: FiniteMap (Module,OccName) Name
-builtins = bagToFM $
- mapBag (\ name -> ((nameModule name, nameOccName name), name))
- builtinNames
+builtins =
+ bagToFM (
+ mapBag (\ name -> ((nameModule name, nameOccName name), name))
+ builtinNames)
-- Initial value for the occurrence pool.
initOccs :: ([Occurrence],[Occurrence]) -- Compulsory and optional respectively
being encoded inside a @Module@.
@setModuleFlavourRn@ fixes up @Module@ values containing
-normal flavours, checking to see whether
+normal flavours, returning a @Module@ value containing
+the attributes of the module that's in scope. The only
+attribute at the moment is the DLLness of a module, i.e.,
+whether the object code for that module resides in a
+Win32 DLL or not.
\begin{code}
setModuleFlavourRn :: Module -> RnM s d Module
| bootFlavour hif = returnRn mod
| otherwise =
getModuleHiMap (bootFlavour hif) `thenRn` \ himap ->
- let mod_pstr = moduleString mod in
case (lookupFM himap mod_pstr) of
Nothing -> returnRn mod
- Just (_,is_in_a_dll) ->
- returnRn (setModuleFlavour (mkDynFlavour is_in_a_dll hif) mod)
- where
- hif = moduleIfaceFlavour mod
+ Just (_, is_in_a_dll) ->
+ returnRn (setModuleFlavour (mkDynFlavour is_in_a_dll hif) mod)
+ where
+ mod_pstr = moduleString mod
+ hif = moduleIfaceFlavour mod
\end{code}
addImplicitOccRn deRefStablePtr_NAME `thenRn_`
addImplicitOccRn bindIO_NAME `thenRn_`
returnRn name'
- _ -> returnRn name') `thenRn_`
- rnHsSigType fo_decl_msg ty `thenRn` \ (ty', fvs) ->
+ _ -> returnRn name') `thenRn_`
+ rnHsSigType fo_decl_msg ty `thenRn` \ (ty', fvs) ->
returnRn (ForD (ForeignDecl name' imp_exp ty' ext_nm cconv src_loc), fvs)
where
fo_decl_msg = ptext SLIT("a foreign declaration")