[project @ 1998-03-06 10:50:44 by simonm]
[ghc-hetmet.git] / ghc / compiler / prelude / PrelInfo.lhs
index 60673c3..3e948ee 100644 (file)
@@ -9,7 +9,7 @@ module PrelInfo (
        builtinNames, derivingOccurrences,
        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,
@@ -21,7 +21,8 @@ module PrelInfo (
        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, assert_RDR,
+       showString_RDR, showParen_RDR, readParen_RDR, lex_RDR,
        showSpace_RDR, showList___RDR, readList___RDR, negate_RDR,
 
        numClass_RDR, fractionalClass_RDR, eqClass_RDR, 
@@ -32,7 +33,7 @@ module PrelInfo (
        main_NAME, allClass_NAME, ioTyCon_NAME,
 
        needsDataDeclCtxtClassKeys, cCallishClassKeys, cCallishTyKeys, isNoDictClass,
-       isNumericClass, isStandardClass, isCcallishClass
+       isNumericClass, isStandardClass, isCcallishClass, isCreturnableClass
     ) where
 
 #include "HsVersions.h"
@@ -170,18 +171,6 @@ data_tycons
     , 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}
 
 %************************************************************************
@@ -207,8 +196,7 @@ wired_in_ids
     , 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
@@ -320,8 +308,9 @@ knownKeyNames
 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}
 
 %************************************************************************
@@ -338,18 +327,18 @@ to write them all down in one place.
 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"))
@@ -369,8 +358,8 @@ realFracClass_RDR   = tcQual (pREL_NUM,  SLIT("RealFrac"))
 realFloatClass_RDR     = tcQual (pREL_NUM,  SLIT("RealFloat"))
 readClass_RDR          = tcQual (pREL_READ, SLIT("Read"))
 ixClass_RDR            = tcQual (iX,        SLIT("Ix"))
-ccallableClass_RDR     = tcQual (gHC__,   SLIT("CCallable"))
-creturnableClass_RDR   = tcQual (gHC__,   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"))
@@ -431,7 +420,8 @@ plus_RDR       = varQual (pREL_BASE, SLIT("+"))
 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_ERR, SLIT("assert__"))
 
 eqH_Char_RDR   = prelude_primop CharEqOp
 ltH_Char_RDR   = prelude_primop CharLtOp
@@ -509,12 +499,14 @@ even though every numeric class has these two as a superclass,
 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