\section[PrelInfo]{The @PrelInfo@ interface to the compiler's prelude knowledge}
\begin{code}
-#include "HsVersions.h"
-
module PrelInfo (
-- finite maps for built-in things (for the renamer and typechecker):
builtinNames, derivingOccurrences,
- SYN_IE(BuiltinNames),
+ BuiltinNames,
- maybeCharLikeTyCon, maybeIntLikeTyCon,
+ maybeCharLikeCon, maybeIntLikeCon,
eq_RDR, ne_RDR, le_RDR, lt_RDR, ge_RDR, gt_RDR, max_RDR, min_RDR,
compare_RDR, minBound_RDR, maxBound_RDR, enumFrom_RDR, enumFromTo_RDR,
ltH_Float_RDR, eqH_Double_RDR, ltH_Double_RDR, eqH_Int_RDR,
ltH_Int_RDR, geH_RDR, leH_RDR, minusH_RDR, false_RDR, true_RDR,
and_RDR, not_RDR, append_RDR, map_RDR, compose_RDR, mkInt_RDR,
- error_RDR, showString_RDR, showParen_RDR, readParen_RDR, lex_RDR,
+ error_RDR, assertErr_RDR,
+ showString_RDR, showParen_RDR, readParen_RDR, lex_RDR,
showSpace_RDR, showList___RDR, readList___RDR, negate_RDR,
numClass_RDR, fractionalClass_RDR, eqClass_RDR,
main_NAME, allClass_NAME, ioTyCon_NAME,
needsDataDeclCtxtClassKeys, cCallishClassKeys, cCallishTyKeys, isNoDictClass,
- isNumericClass, isStandardClass, isCcallishClass
+ isNumericClass, isStandardClass, isCcallishClass, isCreturnableClass
) where
-IMP_Ubiq()
+#include "HsVersions.h"
-#if __GLASGOW_HASKELL__ >= 202
import IdUtils ( primOpName )
-#else
-IMPORT_DELOOPER(PrelLoop) ( primOpName )
-#endif
-- friends:
import PrelMods -- Prelude module names
import TysWiredIn
-- others:
-import SpecEnv ( SpecEnv )
import RdrHsSyn ( RdrName(..), varQual, tcQual, qual )
import BasicTypes ( IfaceFlavour )
-import Id ( GenId, SYN_IE(Id) )
+import Id ( GenId, Id )
import Name ( Name, OccName(..), Provenance(..),
- getName, mkGlobalName, modAndOcc )
-import Class ( Class(..), GenClass, classKey )
+ getName, mkGlobalName, modAndOcc
+ )
+import Class ( Class, classKey )
import TyCon ( tyConDataCons, mkFunTyCon, TyCon )
import Type
import Bag
, voidTyCon
, wordTyCon
]
-
-min_nonprim_tycon_list -- used w/ HideMostBuiltinNames
- = [ boolTyCon
- , charTyCon
- , intTyCon
- , floatTyCon
- , doubleTyCon
- , integerTyCon
- , liftTyCon
- , return2GMPsTyCon -- ADR asked for these last two (WDP 94/11)
- , returnIntAndGMPTyCon
- ]
\end{code}
%************************************************************************
, integerPlusTwoId
, integerZeroId
, nON_EXHAUSTIVE_GUARDS_ERROR_ID
- , nO_DEFAULT_METHOD_ERROR_ID
- , nO_EXPLICIT_METHOD_ERROR_ID
+ , nO_METHOD_BINDING_ERROR_ID
, pAR_ERROR_ID
, pAT_ERROR_ID
, packStringForCId
, rEC_CON_ERROR_ID
, rEC_UPD_ERROR_ID
, realWorldPrimId
- , runSTId
, tRACE_ID
, unpackCString2Id
, unpackCStringAppendId
\begin{code}
mkKnownKeyGlobal :: (RdrName, Unique) -> Name
mkKnownKeyGlobal (Qual mod occ hif, uniq)
- = mkGlobalName uniq mod occ (Implicit hif)
+ = mkGlobalName uniq mod occ NoProvenance
allClass_NAME = mkKnownKeyGlobal (allClass_RDR, allClassKey)
ioTyCon_NAME = mkKnownKeyGlobal (ioTyCon_RDR, ioTyConKey)
-- Others
, (otherwiseId_RDR, otherwiseIdKey)
+ , (assert_RDR, assertIdKey)
]
\end{code}
ToDo: make it do the ``like'' part properly (as in 0.26 and before).
\begin{code}
-maybeCharLikeTyCon tc = if (uniqueOf tc == charDataConKey) then Just charDataCon else Nothing
-maybeIntLikeTyCon tc = if (uniqueOf tc == intDataConKey) then Just intDataCon else Nothing
+maybeCharLikeCon, maybeIntLikeCon :: Id -> Bool
+maybeCharLikeCon con = uniqueOf con == charDataConKey
+maybeIntLikeCon con = uniqueOf con == intDataConKey
\end{code}
%************************************************************************
prelude_primop op = qual (modAndOcc (primOpName op))
intTyCon_RDR = qual (modAndOcc intTyCon)
-ioTyCon_RDR = tcQual (iO_BASE, SLIT("IO"))
-ioDataCon_RDR = varQual (iO_BASE, SLIT("IO"))
-ioOkDataCon_RDR = varQual (iO_BASE, SLIT("IOok"))
+ioTyCon_RDR = tcQual (pREL_IO_BASE, SLIT("IO"))
+ioDataCon_RDR = varQual (pREL_IO_BASE, SLIT("IO"))
+ioOkDataCon_RDR = varQual (pREL_IO_BASE, SLIT("IOok"))
orderingTyCon_RDR = tcQual (pREL_BASE, SLIT("Ordering"))
rationalTyCon_RDR = tcQual (pREL_NUM, SLIT("Rational"))
ratioTyCon_RDR = tcQual (pREL_NUM, SLIT("Ratio"))
ratioDataCon_RDR = varQual (pREL_NUM, SLIT(":%"))
-byteArrayTyCon_RDR = tcQual (aRR_BASE, SLIT("ByteArray"))
-mutableByteArrayTyCon_RDR = tcQual (aRR_BASE, SLIT("MutableByteArray"))
+byteArrayTyCon_RDR = tcQual (pREL_ARR, SLIT("ByteArray"))
+mutableByteArrayTyCon_RDR = tcQual (pREL_ARR, SLIT("MutableByteArray"))
-allClass_RDR = tcQual (gHC__, SLIT("All"))
+allClass_RDR = tcQual (pREL_GHC, SLIT("All"))
eqClass_RDR = tcQual (pREL_BASE, SLIT("Eq"))
ordClass_RDR = tcQual (pREL_BASE, SLIT("Ord"))
evalClass_RDR = tcQual (pREL_BASE, SLIT("Eval"))
realFloatClass_RDR = tcQual (pREL_NUM, SLIT("RealFloat"))
readClass_RDR = tcQual (pREL_READ, SLIT("Read"))
ixClass_RDR = tcQual (iX, SLIT("Ix"))
-ccallableClass_RDR = tcQual (cCALL, SLIT("CCallable"))
-creturnableClass_RDR = tcQual (cCALL, SLIT("CReturnable"))
+ccallableClass_RDR = tcQual (pREL_GHC, SLIT("CCallable"))
+creturnableClass_RDR = tcQual (pREL_GHC, SLIT("CReturnable"))
fromInt_RDR = varQual (pREL_BASE, SLIT("fromInt"))
fromInteger_RDR = varQual (pREL_BASE, SLIT("fromInteger"))
times_RDR = varQual (pREL_BASE, SLIT("*"))
mkInt_RDR = varQual (pREL_BASE, SLIT("I#"))
-error_RDR = varQual (eRROR, SLIT("error"))
+error_RDR = varQual (pREL_ERR, SLIT("error"))
+assert_RDR = varQual (pREL_GHC, SLIT("assert"))
+assertErr_RDR = varQual (pREL_ERR, SLIT("assertError"))
eqH_Char_RDR = prelude_primop CharEqOp
ltH_Char_RDR = prelude_primop CharLtOp
because the list of ambiguous dictionaries hasn't been simplified.
\begin{code}
-isCcallishClass, isNoDictClass, isNumericClass, isStandardClass :: Class -> Bool
-
-isNumericClass clas = classKey clas `is_elem` numericClassKeys
-isStandardClass clas = classKey clas `is_elem` standardClassKeys
-isCcallishClass clas = classKey clas `is_elem` cCallishClassKeys
-isNoDictClass clas = classKey clas `is_elem` noDictClassKeys
+isCcallishClass, isCreturnableClass, isNoDictClass,
+ isNumericClass, isStandardClass :: Class -> Bool
+
+isNumericClass clas = classKey clas `is_elem` numericClassKeys
+isStandardClass clas = classKey clas `is_elem` standardClassKeys
+isCcallishClass clas = classKey clas `is_elem` cCallishClassKeys
+isCreturnableClass clas = classKey clas == cReturnableClassKey
+isNoDictClass clas = classKey clas `is_elem` noDictClassKeys
is_elem = isIn "is_X_Class"
numericClassKeys
-- Renamer always imports these data decls replete with constructors
-- so that desugarer can always see the constructor. Ugh!
-cCallishTyKeys = [ addrTyConKey, wordTyConKey, byteArrayTyConKey, mutableByteArrayTyConKey ]
+cCallishTyKeys = [ addrTyConKey, wordTyConKey, byteArrayTyConKey,
+ mutableByteArrayTyConKey, foreignObjTyConKey ]
standardClassKeys
= derivableClassKeys ++ numericClassKeys ++ cCallishClassKeys