(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)(..),
(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)(..),
(,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)(..),
+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)(..),
+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)(..),
+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)(..),
+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)(..),
+ (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,)(..),
-- Functions: (->)
Eq((==), (/=)),
Ord(compare, (<), (<=), (>=), (>), max, min),
Eval(..{-seq, strict-}), seq, strict, -- NB: glasgow hack
Num((+), (-), (*), negate, abs, signum, fromInteger, fromInt{-partain-}),
Real(toRational),
- Integral(quot, rem, div, mod, quotRem, divMod, toInteger),
+ Integral(quot, rem, div, mod, quotRem, divMod, toInteger, toInt{-partain-}),
Fractional((/), recip, fromRational),
Floating(pi, exp, log, sqrt, (**), logBase, sin, cos, tan,
asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh),
quot, rem, div, mod :: a -> a -> a
quotRem, divMod :: a -> a -> (a,a)
toInteger :: a -> Integer
+ toInt :: a -> Int -- partain: Glasgow extension
n `quot` d = q where (q,r) = quotRem n d
n `rem` d = r where (q,r) = quotRem n d
n `div` d = q where (q,r) = divMod n d
n `mod` d = r where (q,r) = divMod n d
- divMod n d = if signum r == - signum d then (q-1, r+d) else qr
+ divMod n d = if signum r == negate (signum d) then (q-1, r+d) else qr
where qr@(q,r) = quotRem n d
class (Num a) => Fractional a where
exponent x = if m == 0 then 0 else n + floatDigits x
where (m,n) = decodeFloat x
- significand x = encodeFloat m (- floatDigits x)
+ significand x = encodeFloat m (negate (floatDigits x))
where (m,_) = decodeFloat x
scaleFloat k x = encodeFloat m (n+k)
_ ^ _ = error "Prelude.^: negative exponent"
(^^) :: (Fractional a, Integral b) => a -> b -> a
-x ^^ n = if n >= 0 then x^n else recip (x^(-n))
+x ^^ n = if n >= 0 then x^n else recip (x^(negate n))
fromIntegral :: (Integral a, Num b) => a -> b
fromIntegral = fromInteger . toInteger
( 0, 1) -> 0
( 1, 0) -> pi/2
( 0,-1) -> pi
- (-1, 0) -> -pi/2
+ (-1, 0) -> (negate pi)/2
( _, 1) -> atan (y/x)
( _,-1) -> atan (y/x) + pi
( 0, 0) -> error "Prelude.atan2: atan2 of origin"
instance CReturnable Int
instance Bounded Int where
- minBound = -2147483647 -- **********************
- maxBound = 2147483647 -- **********************
+ minBound = negate 2147483647 -- **********************
+ maxBound = 2147483647 -- **********************
instance Num Int where
(+) x y = plusInt x y
--OLD: odd x = neInt (x `mod` 2) 0
toInteger (I# n#) = int2Integer# n# -- give back a full-blown Integer
--- toInt x = x
+ toInt x = x
instance Enum Int where
toEnum x = x
#else
{-# INLINE enumFrom #-}
{-# INLINE enumFromTo #-}
- enumFrom x = _build (\ c _ ->
+ enumFrom x = build (\ c _ ->
let g x = x `c` g (x `plusInt` 1) in g x)
- enumFromTo x y = _build (\ c n ->
+ enumFromTo x y = build (\ c n ->
let g x = if x <= y then x `c` g (x `plusInt` 1) else n in g x)
#endif
enumFromThen m n = en' m (n `minusInt` m)
in
if cmp ># 0# then 1
else if cmp ==# 0# then 0
- else -1
+ else (negate 1)
}
fromInteger x = x
-> (J# a3 s3 d3, J# a4 s4 d4)
-}
toInteger n = n
--- toInt (J# a s d) = case (integer2Int# a s d) of { n# -> I# n# }
+ toInt (J# a s d) = case (integer2Int# a s d) of { n# -> I# n# }
-- the rest are identical to the report default methods;
-- you get slightly better code if you let the compiler
n `mod` d = r where (q,r) = divMod n d
divMod n d = case (quotRem n d) of { qr@(q,r) ->
- if signum r == - signum d then (q - 1, r+d) else qr }
+ if signum r == negate (signum d) then (q - 1, r+d) else qr }
-- Case-ified by WDP 94/10
instance Enum Integer where
(*) x y = timesFloat x y
abs x | x >= 0.0 = x
| otherwise = negateFloat x
- signum x | x == 0.0 = 0
- | x > 0.0 = 1
- | otherwise = -1
+ signum x | x == 0.0 = 0
+ | x > 0.0 = 1
+ | otherwise = negate 1
fromInteger n = encodeFloat n 0
fromInt i = int2Float i
if n >= 0 then
(fromInteger m * fromInteger b ^ n, 0.0)
else
- case (quotRem m (b^(-n))) of { (w,r) ->
+ case (quotRem m (b^(negate n))) of { (w,r) ->
(fromInteger w, encodeFloat r n)
}
}
(m,n) -> if m == 0 then 0 else n + floatDigits x
significand x = case decodeFloat x of
- (m,_) -> encodeFloat m (- (floatDigits x))
+ (m,_) -> encodeFloat m (negate (floatDigits x))
scaleFloat k x = case decodeFloat x of
(m,n) -> encodeFloat m (n+k)
(*) x y = timesDouble x y
abs x | x >= 0.0 = x
| otherwise = negateDouble x
- signum x | x == 0.0 = 0
- | x > 0.0 = 1
- | otherwise = -1
+ signum x | x == 0.0 = 0
+ | x > 0.0 = 1
+ | otherwise = negate 1
fromInteger n = encodeFloat n 0
fromInt (I# n#) = case (int2Double# n#) of { d# -> D# d# }
if n >= 0 then
(fromInteger m * fromInteger b ^ n, 0.0)
else
- case (quotRem m (b^(-n))) of { (w,r) ->
+ case (quotRem m (b^(negate n))) of { (w,r) ->
(fromInteger w, encodeFloat r n)
}
}
(m,n) -> if m == 0 then 0 else n + floatDigits x
significand x = case decodeFloat x of
- (m,_) -> encodeFloat m (- (floatDigits x))
+ (m,_) -> encodeFloat m (negate (floatDigits x))
scaleFloat k x = case decodeFloat x of
(m,n) -> encodeFloat m (n+k)
= (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_
data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_
= (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_
+data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_
+ = (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_
+data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_
+ = (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_
+data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_
+ = (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_
+data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_
+ = (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_
+data (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_
+ = (,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,) a b c d e f g h i j k l m n o p q r s t u v w x y z a_ b_ c_ d_ e_ f_ g_ h_ i_ j_ k_
+ -- if you add more tuples, you need to change the compiler, too
+ -- (it has a wired-in number: 37)
instance (Read a, Read b) => Read (a,b) where
readsPrec p = readParen False