[project @ 2000-09-26 16:45:33 by simonpj]
authorsimonpj <unknown>
Tue, 26 Sep 2000 16:45:35 +0000 (16:45 +0000)
committersimonpj <unknown>
Tue, 26 Sep 2000 16:45:35 +0000 (16:45 +0000)
* Remove all traces of addr2Integer.  Big integer literals are now
  done by multiplying up small integers.

* As a result, we can remove PrelNum.hi-boot altogether.

* Correct the default method for (==) in PrelBase.  (It simply
  returned True, which seems bogus to me!)

* Add a type signature for PrelBase.mapFB

ghc/compiler/basicTypes/Unique.lhs
ghc/compiler/prelude/PrelInfo.lhs
ghc/compiler/prelude/PrelNames.lhs
ghc/compiler/prelude/primops.txt
ghc/includes/PrimOps.h
ghc/lib/std/PrelBase.lhs
ghc/lib/std/PrelGHC.hi-boot
ghc/lib/std/PrelNum.lhs
ghc/rts/PrimOps.hc

index 97c99f8..1282995 100644 (file)
@@ -114,7 +114,6 @@ module Unique (
        integerPlusOneIdKey,
        integerPlusTwoIdKey,
        int2IntegerIdKey,
-       addr2IntegerIdKey,
        integerTyConKey,
        integerZeroIdKey,
        integralClassKey,
@@ -625,7 +624,6 @@ integerPlusOneIdKey       = mkPreludeMiscIdUnique 10
 integerPlusTwoIdKey          = mkPreludeMiscIdUnique 11
 integerZeroIdKey             = mkPreludeMiscIdUnique 12
 int2IntegerIdKey             = mkPreludeMiscIdUnique 13
-addr2IntegerIdKey            = mkPreludeMiscIdUnique 14
 irrefutPatErrorIdKey         = mkPreludeMiscIdUnique 15
 eqStringIdKey                = mkPreludeMiscIdUnique 16
 noMethodBindingErrorIdKey     = mkPreludeMiscIdUnique 17
index 23c04ce..cfe7a82 100644 (file)
@@ -256,7 +256,6 @@ knownKeyNames
     , (makeStablePtr_RDR,      makeStablePtrIdKey)
     , (bindIO_RDR,             bindIOIdKey)
     , (returnIO_RDR,           returnIOIdKey)
-    , (addr2Integer_RDR,       addr2IntegerIdKey)
 
        -- Strings and lists
     , (map_RDR,                        mapIdKey)
index 379dff9..073bfae 100644 (file)
@@ -37,8 +37,7 @@ module PrelNames
        error_RDR, assertErr_RDR, 
        showString_RDR, showParen_RDR, readParen_RDR, lex_RDR,
        showSpace_RDR, showList___RDR, readList___RDR, negate_RDR,
-       addr2Integer_RDR, ioTyCon_RDR,
-       foldr_RDR, build_RDR, getTag_RDR, plusInteger_RDR, timesInteger_RDR, eqString_RDR,
+       ioTyCon_RDR, foldr_RDR, build_RDR, getTag_RDR, plusInteger_RDR, timesInteger_RDR, eqString_RDR,
 
        orderingTyCon_RDR, rationalTyCon_RDR, ratioTyCon_RDR, byteArrayTyCon_RDR,
        mutableByteArrayTyCon_RDR, foreignObjTyCon_RDR,
@@ -268,7 +267,6 @@ minus_RDR      = varQual pREL_NUM_Name SLIT("-")
 negate_RDR        = varQual pREL_NUM_Name SLIT("negate")
 plus_RDR          = varQual pREL_NUM_Name SLIT("+")
 times_RDR         = varQual pREL_NUM_Name SLIT("*")
-addr2Integer_RDR   = varQual pREL_NUM_Name SLIT("addr2Integer")
 plusInteger_RDR           = varQual pREL_NUM_Name SLIT("plusInteger")
 timesInteger_RDR   = varQual pREL_NUM_Name SLIT("timesInteger")
 
index d021264..5eff2f5 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------
--- $Id: primops.txt,v 1.4 2000/09/11 12:20:57 sewardj Exp $
+-- $Id: primops.txt,v 1.5 2000/09/26 16:45:34 simonpj Exp $
 --
 -- Primitive Operations
 --
@@ -65,10 +65,6 @@ primop   AddrLeOp  "leAddr#"   Compare   Addr# -> Addr# -> Bool
 
 primop   Addr2IntOp  "addr2Int#"     GenPrimOp   Addr# -> Int#
 
-primop   Addr2IntegerOp  "addr2Integer#" GenPrimOp   
-   Addr# -> (# Int#, ByteArr# #)
-   with out_of_line = True
-
 
 ------------------------------------------------------------------------
 --- Char#                                                            ---
index 3411d51..71bc8af 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: PrimOps.h,v 1.62 2000/09/11 11:17:09 sewardj Exp $
+ * $Id: PrimOps.h,v 1.63 2000/09/26 16:45:34 simonpj Exp $
  *
  * (c) The GHC Team, 1998-1999
  *
@@ -439,7 +439,6 @@ EXTFUN_RTS(divModIntegerzh_fast);
 /* Conversions */
 EXTFUN_RTS(int2Integerzh_fast);
 EXTFUN_RTS(word2Integerzh_fast);
-EXTFUN_RTS(addr2Integerzh_fast);
 
 /* Floating-point decodings */
 EXTFUN_RTS(decodeFloatzh_fast);
index 315469d..f1e7c55 100644 (file)
@@ -1,5 +1,5 @@
 % -----------------------------------------------------------------------------
-% $Id: PrelBase.lhs,v 1.37 2000/09/07 09:10:07 simonpj Exp $
+% $Id: PrelBase.lhs,v 1.38 2000/09/26 16:45:34 simonpj Exp $
 %
 % (c) The University of Glasgow, 1992-2000
 %
@@ -79,14 +79,12 @@ module PrelBase
        (
        module PrelBase,
        module PrelGHC,         -- Re-export PrelGHC, PrelErr & PrelNum, to avoid lots
-       module PrelErr,         -- of people having to import it explicitly
-       module PrelNum
+       module PrelErr          -- of people having to import it explicitly
   ) 
        where
 
 import PrelGHC
 import {-# SOURCE #-} PrelErr
-import {-# SOURCE #-} PrelNum
 
 infixr 9  .
 infixr 5  ++, :
@@ -146,11 +144,8 @@ unpackCStringUtf8# a = error "urk"
 class  Eq a  where
     (==), (/=)         :: a -> a -> Bool
 
---    x /= y           = not (x == y)
---    x == y           = not (x /= y)
---    x /= y           =  True
-    (/=) x y            = not  ((==) x y)
-    x == y             =  True
+    (/=) x y            = not ((==) x y)
+    (==) x y           = not ((/=) x y)
 
 class  (Eq a) => Ord a  where
     compare             :: a -> a -> Ordering
@@ -261,7 +256,7 @@ foldr            :: (a -> b -> b) -> b -> [a] -> b
 foldr k z xs = go xs
             where
               go []     = z
-              go (x:xs) = x `k` go xs
+              go (y:ys) = y `k` go ys
 
 build  :: forall a. (forall b. (a -> b -> b) -> b -> b) -> [a]
 {-# INLINE 2 build #-}
@@ -312,6 +307,7 @@ map :: (a -> b) -> [a] -> [b]
 map = mapList
 
 -- Note eta expanded
+mapFB ::  (elt -> lst -> lst) -> (a -> elt) -> a -> lst -> lst
 mapFB c f x ys = c (f x) ys
 
 mapList :: (a -> b) -> [a] -> [b]
index 6ccc4d1..13f4aac 100644 (file)
@@ -123,7 +123,6 @@ __export PrelGHC
   leAddrzh
   int2Addrzh
   addr2Intzh
-  addr2Integerzh
 
   Floatzh
   gtFloatzh
index 2939358..31d5c7a 100644 (file)
@@ -1,5 +1,5 @@
 % ------------------------------------------------------------------------------
-% $Id: PrelNum.lhs,v 1.33 2000/09/25 12:58:39 simonpj Exp $
+% $Id: PrelNum.lhs,v 1.34 2000/09/26 16:45:34 simonpj Exp $
 %
 % (c) The University of Glasgow, 1994-2000
 %
@@ -129,10 +129,6 @@ integer2Int :: Integer -> Int
 integer2Int (S# i)   = I# i
 integer2Int (J# s d) = case (integer2Int# s d) of { n# -> I# n# }
 
-addr2Integer :: Addr# -> Integer
-{-# INLINE addr2Integer #-}
-addr2Integer x = case addr2Integer# x of (# s, d #) -> J# s d
-
 toBig (S# i)     = case int2Integer# i of { (# s, d #) -> J# s d }
 toBig i@(J# _ _) = i
 \end{code}
index 74575d7..f5c45f3 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: PrimOps.hc,v 1.54 2000/08/25 13:12:07 simonmar Exp $
+ * $Id: PrimOps.hc,v 1.55 2000/09/26 16:45:35 simonpj Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -504,30 +504,6 @@ FN_(word2Integerzh_fast)
    FE_
 }
 
-FN_(addr2Integerzh_fast)
-{
-  MP_INT result;
-  char *str;
-  FB_
-
-  MAYBE_GC(NO_PTRS,addr2Integerzh_fast);
-
-  /* args:   R1 :: Addr# */
-  str = R1.a;
-
-  /* Perform the operation */
-  if (RET_STGCALL3(int, mpz_init_set_str,&result,(str),/*base*/10))
-      abort();
-
-   /* returns (# size  :: Int#, 
-                data  :: ByteArray# 
-              #)
-   */
-  TICK_RET_UNBOXED_TUP(2);
-  RET_NP(result._mp_size, 
-         result._mp_d - sizeofW(StgArrWords));
-  FE_
-}
 
 /*
  * 'long long' primops for converting to/from Integers.