Commit 70c5660c authored by simonpj's avatar simonpj
Browse files

[project @ 2000-09-26 16:45:33 by simonpj]

* 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
parent 603eccf7
......@@ -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
......
......@@ -256,7 +256,6 @@ knownKeyNames
, (makeStablePtr_RDR, makeStablePtrIdKey)
, (bindIO_RDR, bindIOIdKey)
, (returnIO_RDR, returnIOIdKey)
, (addr2Integer_RDR, addr2IntegerIdKey)
-- Strings and lists
, (map_RDR, mapIdKey)
......
......@@ -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")
......
-----------------------------------------------------------------------
-- $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# ---
......
/* -----------------------------------------------------------------------------
* $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);
......
% -----------------------------------------------------------------------------
% $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]
......
......@@ -123,7 +123,6 @@ __export PrelGHC
leAddrzh
int2Addrzh
addr2Intzh
addr2Integerzh
Floatzh
gtFloatzh
......
% ------------------------------------------------------------------------------
% $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}
......
/* -----------------------------------------------------------------------------
* $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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment