Commit 12a50ca3 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Fix warnings

parent 4875183e
......@@ -95,9 +95,9 @@ class Num a => Bits a where
question. -}
shift :: a -> Int -> a
x `shift` i | i<0 = x `shiftR` (-i)
| i==0 = x
| i>0 = x `shiftL` i
x `shift` i | i<0 = x `shiftR` (-i)
| i>0 = x `shiftL` i
| otherwise = x
{-| @'rotate' x i@ rotates @x@ left by @i@ bits if @i@ is positive,
or right by @-i@ bits otherwise.
......@@ -109,9 +109,9 @@ class Num a => Bits a where
question. -}
rotate :: a -> Int -> a
x `rotate` i | i<0 = x `rotateR` (-i)
| i==0 = x
| i>0 = x `rotateL` i
x `rotate` i | i<0 = x `rotateR` (-i)
| i>0 = x `rotateL` i
| otherwise = x
{-
-- Rotation can be implemented in terms of two shifts, but care is
......
......@@ -434,7 +434,7 @@ intercalate xs xss = concat (intersperse xs xss)
transpose :: [[a]] -> [[a]]
transpose [] = []
transpose ([] : xss) = transpose xss
transpose ((x:xs) : xss) = (x : [h | (h:t) <- xss]) : transpose (xs : [ t | (h:t) <- xss])
transpose ((x:xs) : xss) = (x : [h | (h:_) <- xss]) : transpose (xs : [ t | (_:t) <- xss])
-- | The 'partition' function takes a predicate a list and returns
......@@ -447,6 +447,7 @@ partition :: (a -> Bool) -> [a] -> ([a],[a])
{-# INLINE partition #-}
partition p xs = foldr (select p) ([],[]) xs
select :: (a -> Bool) -> a -> ([a], [a]) -> ([a], [a])
select p x ~(ts,fs) | p x = (x:ts,fs)
| otherwise = (ts, x:fs)
......@@ -543,22 +544,22 @@ strictMinimum xs = foldl1' min xs
-- The list must be finite and non-empty.
maximumBy :: (a -> a -> Ordering) -> [a] -> a
maximumBy _ [] = error "List.maximumBy: empty list"
maximumBy cmp xs = foldl1 max xs
maximumBy cmp xs = foldl1 maxBy xs
where
max x y = case cmp x y of
GT -> x
_ -> y
maxBy x y = case cmp x y of
GT -> x
_ -> y
-- | The 'minimumBy' function takes a comparison function and a list
-- and returns the least element of the list by the comparison function.
-- The list must be finite and non-empty.
minimumBy :: (a -> a -> Ordering) -> [a] -> a
minimumBy _ [] = error "List.minimumBy: empty list"
minimumBy cmp xs = foldl1 min xs
minimumBy cmp xs = foldl1 minBy xs
where
min x y = case cmp x y of
GT -> y
_ -> x
minBy x y = case cmp x y of
GT -> y
_ -> x
-- | The 'genericLength' function is an overloaded version of 'length'. In
-- particular, instead of returning an 'Int', it returns any type which is
......@@ -754,12 +755,12 @@ nonEmptySubsequences (x:xs) = [x] : foldr f [] (nonEmptySubsequences xs)
--
-- > permutations "abc" == ["abc","bac","cba","bca","cab","acb"]
permutations :: [a] -> [[a]]
permutations xs = xs : perms xs []
permutations xs0 = xs0 : perms xs0 []
where
perms [] is = []
perms [] _ = []
perms (t:ts) is = foldr interleave (perms ts (t:is)) (permutations is)
where interleave xs r = let (_,zs) = interleave' id xs r in zs
interleave' f [] r = (ts, r)
interleave' _ [] r = (ts, r)
interleave' f (y:ys) r = let (us,zs) = interleave' (f . (y:)) ys r
in (y:us, f (t:y:us) : zs)
......@@ -830,18 +831,18 @@ mergesort :: (a -> a -> Ordering) -> [a] -> [a]
mergesort cmp = mergesort' cmp . map wrap
mergesort' :: (a -> a -> Ordering) -> [[a]] -> [a]
mergesort' cmp [] = []
mergesort' cmp [xs] = xs
mergesort' _ [] = []
mergesort' _ [xs] = xs
mergesort' cmp xss = mergesort' cmp (merge_pairs cmp xss)
merge_pairs :: (a -> a -> Ordering) -> [[a]] -> [[a]]
merge_pairs cmp [] = []
merge_pairs cmp [xs] = [xs]
merge_pairs _ [] = []
merge_pairs _ [xs] = [xs]
merge_pairs cmp (xs:ys:xss) = merge cmp xs ys : merge_pairs cmp xss
merge :: (a -> a -> Ordering) -> [a] -> [a] -> [a]
merge cmp [] ys = ys
merge cmp xs [] = xs
merge _ [] ys = ys
merge _ xs [] = xs
merge cmp (x:xs) (y:ys)
= case x `cmp` y of
GT -> y : merge cmp (x:xs) ys
......@@ -921,7 +922,7 @@ unfoldr f b =
-- | A strict version of 'foldl'.
foldl' :: (a -> b -> a) -> a -> [b] -> a
#ifdef __GLASGOW_HASKELL__
foldl' f z xs = lgo z xs
foldl' f z0 xs0 = lgo z0 xs0
where lgo z [] = z
lgo z (x:xs) = let z' = f z x in z' `seq` lgo z' xs
#else
......
{-# OPTIONS_GHC -XNoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- XXX -fno-warn-unused-imports needed for the GHC.Tuple import below. Sigh.
-----------------------------------------------------------------------------
-- |
-- Module : Data.Tuple
......
......@@ -517,25 +517,25 @@ tup4Tc :: TyCon
tup4Tc = mkTyCon "(,,,)"
instance Typeable4 (,,,) where
typeOf4 tu = mkTyConApp tup4Tc []
typeOf4 _ = mkTyConApp tup4Tc []
tup5Tc :: TyCon
tup5Tc = mkTyCon "(,,,,)"
instance Typeable5 (,,,,) where
typeOf5 tu = mkTyConApp tup5Tc []
typeOf5 _ = mkTyConApp tup5Tc []
tup6Tc :: TyCon
tup6Tc = mkTyCon "(,,,,,)"
instance Typeable6 (,,,,,) where
typeOf6 tu = mkTyConApp tup6Tc []
typeOf6 _ = mkTyConApp tup6Tc []
tup7Tc :: TyCon
tup7Tc = mkTyCon "(,,,,,,)"
instance Typeable7 (,,,,,,) where
typeOf7 tu = mkTyConApp tup7Tc []
typeOf7 _ = mkTyConApp tup7Tc []
#endif /* __NHC__ */
INSTANCE_TYPEABLE1(Ptr,ptrTc,"Ptr")
......@@ -629,7 +629,7 @@ cache = unsafePerformIO $ do
newKey :: IORef Key -> IO Key
#ifdef __GLASGOW_HASKELL__
newKey kloc = do i <- genSym; return (Key i)
newKey _ = do i <- genSym; return (Key i)
#else
newKey kloc = do { k@(Key i) <- readIORef kloc ;
writeIORef kloc (Key (i+1)) ;
......
{-# OPTIONS_GHC -XNoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
-- XXX -fno-warn-unused-binds stops us warning about unused constructors,
-- but really we should just remove them if we don't want them
-----------------------------------------------------------------------------
-- |
-- Module : Foreign.C.Types
......
......@@ -463,7 +463,7 @@ indices (Array l u _ _) = range (l,u)
-- | The list of elements of an array in index order.
{-# INLINE elems #-}
elems :: Ix i => Array i e -> [e]
elems arr@(Array l u n _) =
elems arr@(Array _ _ n _) =
[unsafeAt arr i | i <- [0 .. n - 1]]
-- | The list of associations of an array in index order.
......@@ -493,19 +493,19 @@ accumArray :: Ix i
-> (i,i) -- ^ bounds of the array
-> [(i, a)] -- ^ association list
-> Array i e
accumArray f init (l,u) ies =
accumArray f initial (l,u) ies =
let n = safeRangeSize (l,u)
in unsafeAccumArray' f init (l,u) n
in unsafeAccumArray' f initial (l,u) n
[(safeIndex (l,u) n i, e) | (i, e) <- ies]
{-# INLINE unsafeAccumArray #-}
unsafeAccumArray :: Ix i => (e -> a -> e) -> e -> (i,i) -> [(Int, a)] -> Array i e
unsafeAccumArray f init b ies = unsafeAccumArray' f init b (rangeSize b) ies
unsafeAccumArray f initial b ies = unsafeAccumArray' f initial b (rangeSize b) ies
{-# INLINE unsafeAccumArray' #-}
unsafeAccumArray' :: Ix i => (e -> a -> e) -> e -> (i,i) -> Int -> [(Int, a)] -> Array i e
unsafeAccumArray' f init (l,u) n@(I# n#) ies = runST (ST $ \s1# ->
case newArray# n# init s1# of { (# s2#, marr# #) ->
unsafeAccumArray' f initial (l,u) n@(I# n#) ies = runST (ST $ \s1# ->
case newArray# n# initial s1# of { (# s2#, marr# #) ->
foldr (adjust f marr#) (done l u n marr#) ies s2# })
{-# INLINE adjust #-}
......@@ -651,9 +651,9 @@ might be different, though.
\begin{code}
{-# INLINE newSTArray #-}
newSTArray :: Ix i => (i,i) -> e -> ST s (STArray s i e)
newSTArray (l,u) init = ST $ \s1# ->
newSTArray (l,u) initial = ST $ \s1# ->
case safeRangeSize (l,u) of { n@(I# n#) ->
case newArray# n# init s1# of { (# s2#, marr# #) ->
case newArray# n# initial s1# of { (# s2#, marr# #) ->
(# s2#, STArray l u n marr# #) }}
{-# INLINE boundsSTArray #-}
......
......@@ -618,7 +618,7 @@ String equality is used when desugaring pattern-matches against strings.
eqString :: String -> String -> Bool
eqString [] [] = True
eqString (c1:cs1) (c2:cs2) = c1 == c2 && cs1 `eqString` cs2
eqString cs1 cs2 = False
eqString _ _ = False
{-# RULES "eqString" (==) = eqString #-}
-- eqString also has a BuiltInRule in PrelRules.lhs:
......@@ -728,7 +728,7 @@ inline x = x
-- but from Template Haskell onwards it's simply
-- defined here in Base.lhs
assert :: Bool -> a -> a
assert pred r = r
assert _pred r = r
breakpoint :: a -> a
breakpoint r = r
......
......@@ -350,23 +350,27 @@ instance Enum Char where
-- We can do better than for Ints because we don't
-- have hassles about arithmetic overflow at maxBound
{-# INLINE [0] eftCharFB #-}
eftCharFB c n x y = go x
eftCharFB :: (Char -> a -> a) -> a -> Int# -> Int# -> a
eftCharFB c n x0 y = go x0
where
go x | x ># y = n
| otherwise = C# (chr# x) `c` go (x +# 1#)
eftChar x y | x ># y = []
| otherwise = C# (chr# x) : eftChar (x +# 1#) y
eftChar :: Int# -> Int# -> String
eftChar x y | x ># y = []
| otherwise = C# (chr# x) : eftChar (x +# 1#) y
-- For enumFromThenTo we give up on inlining
{-# NOINLINE [0] efdCharFB #-}
efdCharFB :: (Char -> a -> a) -> a -> Int# -> Int# -> a
efdCharFB c n x1 x2
| delta >=# 0# = go_up_char_fb c n x1 delta 0x10FFFF#
| otherwise = go_dn_char_fb c n x1 delta 0#
where
delta = x2 -# x1
efdChar :: Int# -> Int# -> String
efdChar x1 x2
| delta >=# 0# = go_up_char_list x1 delta 0x10FFFF#
| otherwise = go_dn_char_list x1 delta 0#
......@@ -374,38 +378,44 @@ efdChar x1 x2
delta = x2 -# x1
{-# NOINLINE [0] efdtCharFB #-}
efdtCharFB :: (Char -> a -> a) -> a -> Int# -> Int# -> Int# -> a
efdtCharFB c n x1 x2 lim
| delta >=# 0# = go_up_char_fb c n x1 delta lim
| otherwise = go_dn_char_fb c n x1 delta lim
where
delta = x2 -# x1
efdtChar :: Int# -> Int# -> Int# -> String
efdtChar x1 x2 lim
| delta >=# 0# = go_up_char_list x1 delta lim
| otherwise = go_dn_char_list x1 delta lim
where
delta = x2 -# x1
go_up_char_fb c n x delta lim
= go_up x
go_up_char_fb :: (Char -> a -> a) -> a -> Int# -> Int# -> Int# -> a
go_up_char_fb c n x0 delta lim
= go_up x0
where
go_up x | x ># lim = n
| otherwise = C# (chr# x) `c` go_up (x +# delta)
go_dn_char_fb c n x delta lim
= go_dn x
go_dn_char_fb :: (Char -> a -> a) -> a -> Int# -> Int# -> Int# -> a
go_dn_char_fb c n x0 delta lim
= go_dn x0
where
go_dn x | x <# lim = n
| otherwise = C# (chr# x) `c` go_dn (x +# delta)
go_up_char_list x delta lim
= go_up x
go_up_char_list :: Int# -> Int# -> Int# -> String
go_up_char_list x0 delta lim
= go_up x0
where
go_up x | x ># lim = []
| otherwise = C# (chr# x) : go_up (x +# delta)
go_dn_char_list x delta lim
= go_dn x
go_dn_char_list :: Int# -> Int# -> Int# -> String
go_dn_char_list x0 delta lim
= go_dn x0
where
go_dn x | x <# lim = []
| otherwise = C# (chr# x) : go_dn (x +# delta)
......@@ -468,15 +478,15 @@ instance Enum Int where
eftInt :: Int# -> Int# -> [Int]
-- [x1..x2]
eftInt x y | x ># y = []
| otherwise = go x
eftInt x0 y | x0 ># y = []
| otherwise = go x0
where
go x = I# x : if x ==# y then [] else go (x +# 1#)
{-# INLINE [0] eftIntFB #-}
eftIntFB :: (Int -> r -> r) -> r -> Int# -> Int# -> r
eftIntFB c n x y | x ># y = n
| otherwise = go x
eftIntFB c n x0 y | x0 ># y = n
| otherwise = go x0
where
go x = I# x `c` if x ==# y then n else go (x +# 1#)
-- Watch out for y=maxBound; hence ==, not >
......
......@@ -520,6 +520,7 @@ formatRealFloat fmt decs x
"0" -> "0.0e0"
[d] -> d : ".0e" ++ show_e'
(d:ds') -> d : '.' : ds' ++ "e" ++ show_e'
[] -> error "formatRealFloat/doFmt/FFExponent: []"
Just dec ->
let dec' = max dec 1 in
case is of
......@@ -565,6 +566,7 @@ roundTo base d is =
case f d is of
x@(0,_) -> x
(1,xs) -> (1, 1:xs)
_ -> error "roundTo: bad Value"
where
b2 = base `div` 2
......@@ -732,13 +734,13 @@ Now, here's Lennart's code (which works)
fromRat :: (RealFloat a) => Rational -> a
-- Deal with special cases first, delegating the real work to fromRat'
fromRat (n :% 0) | n > 0 = 1/0 -- +Infinity
| n == 0 = 0/0 -- NaN
| n < 0 = -1/0 -- -Infinity
fromRat (n :% 0) | n > 0 = 1/0 -- +Infinity
| n < 0 = -1/0 -- -Infinity
| otherwise = 0/0 -- NaN
fromRat (n :% d) | n > 0 = fromRat' (n :% d)
| n == 0 = encodeFloat 0 0 -- Zero
| n < 0 = - fromRat' ((-n) :% d)
fromRat (n :% d) | n > 0 = fromRat' (n :% d)
| n < 0 = - fromRat' ((-n) :% d)
| otherwise = encodeFloat 0 0 -- Zero
-- Conversion process:
-- Scale the rational number by the RealFloat base until
......
......@@ -138,9 +138,9 @@ mallocForeignPtr = doMalloc undefined
doMalloc a = do
r <- newIORef []
IO $ \s ->
case newPinnedByteArray# size s of { (# s, mbarr# #) ->
(# s, ForeignPtr (byteArrayContents# (unsafeCoerce# mbarr#))
(MallocPtr mbarr# r) #)
case newPinnedByteArray# size s of { (# s', mbarr# #) ->
(# s', ForeignPtr (byteArrayContents# (unsafeCoerce# mbarr#))
(MallocPtr mbarr# r) #)
}
where (I# size) = sizeOf a
......@@ -150,9 +150,9 @@ mallocForeignPtrBytes :: Int -> IO (ForeignPtr a)
mallocForeignPtrBytes (I# size) = do
r <- newIORef []
IO $ \s ->
case newPinnedByteArray# size s of { (# s, mbarr# #) ->
(# s, ForeignPtr (byteArrayContents# (unsafeCoerce# mbarr#))
(MallocPtr mbarr# r) #)
case newPinnedByteArray# size s of { (# s', mbarr# #) ->
(# s', ForeignPtr (byteArrayContents# (unsafeCoerce# mbarr#))
(MallocPtr mbarr# r) #)
}
-- | Allocate some memory and return a 'ForeignPtr' to it. The memory
......@@ -172,9 +172,9 @@ mallocPlainForeignPtr :: Storable a => IO (ForeignPtr a)
mallocPlainForeignPtr = doMalloc undefined
where doMalloc :: Storable b => b -> IO (ForeignPtr b)
doMalloc a = IO $ \s ->
case newPinnedByteArray# size s of { (# s, mbarr# #) ->
(# s, ForeignPtr (byteArrayContents# (unsafeCoerce# mbarr#))
(PlainPtr mbarr#) #)
case newPinnedByteArray# size s of { (# s', mbarr# #) ->
(# s', ForeignPtr (byteArrayContents# (unsafeCoerce# mbarr#))
(PlainPtr mbarr#) #)
}
where (I# size) = sizeOf a
......@@ -184,9 +184,9 @@ mallocPlainForeignPtr = doMalloc undefined
-- exception to be thrown.
mallocPlainForeignPtrBytes :: Int -> IO (ForeignPtr a)
mallocPlainForeignPtrBytes (I# size) = IO $ \s ->
case newPinnedByteArray# size s of { (# s, mbarr# #) ->
(# s, ForeignPtr (byteArrayContents# (unsafeCoerce# mbarr#))
(PlainPtr mbarr#) #)
case newPinnedByteArray# size s of { (# s', mbarr# #) ->
(# s', ForeignPtr (byteArrayContents# (unsafeCoerce# mbarr#))
(PlainPtr mbarr#) #)
}
addForeignPtrFinalizer :: FinalizerPtr a -> ForeignPtr a -> IO ()
......@@ -212,16 +212,17 @@ addForeignPtrConcFinalizer :: ForeignPtr a -> IO () -> IO ()
-- are finalized objects, so a finalizer should not refer to a 'Handle'
-- (including @stdout@, @stdin@ or @stderr@).
--
addForeignPtrConcFinalizer (ForeignPtr a c) finalizer =
addForeignPtrConcFinalizer (ForeignPtr _ c) finalizer =
addForeignPtrConcFinalizer_ c finalizer
addForeignPtrConcFinalizer_ f@(PlainForeignPtr r) finalizer = do
addForeignPtrConcFinalizer_ :: ForeignPtrContents -> IO () -> IO ()
addForeignPtrConcFinalizer_ (PlainForeignPtr r) finalizer = do
fs <- readIORef r
writeIORef r (finalizer : fs)
if (null fs)
then IO $ \s ->
case r of { IORef (STRef r#) ->
case mkWeak# r# () (foreignPtrFinalizer r) s of { (# s1, w #) ->
case mkWeak# r# () (foreignPtrFinalizer r) s of { (# s1, _ #) ->
(# s1, () #) }}
else return ()
addForeignPtrConcFinalizer_ f@(MallocPtr fo r) finalizer = do
......@@ -230,7 +231,7 @@ addForeignPtrConcFinalizer_ f@(MallocPtr fo r) finalizer = do
if (null fs)
then IO $ \s ->
case mkWeak# fo () (do foreignPtrFinalizer r; touch f) s of
(# s1, w #) -> (# s1, () #)
(# s1, _ #) -> (# s1, () #)
else return ()
addForeignPtrConcFinalizer_ _ _ =
......@@ -274,9 +275,10 @@ touchForeignPtr :: ForeignPtr a -> IO ()
-- result in artificial deadlock. Another alternative is to use
-- explicit reference counting.
--
touchForeignPtr (ForeignPtr fo r) = touch r
touchForeignPtr (ForeignPtr _ r) = touch r
touch r = IO $ \s -> case touch# r s of s -> (# s, () #)
touch :: ForeignPtrContents -> IO ()
touch r = IO $ \s -> case touch# r s of s' -> (# s', () #)
unsafeForeignPtrToPtr :: ForeignPtr a -> Ptr a
-- ^This function extracts the pointer component of a foreign
......@@ -293,7 +295,7 @@ unsafeForeignPtrToPtr :: ForeignPtr a -> Ptr a
-- than combinations of 'unsafeForeignPtrToPtr' and
-- 'touchForeignPtr'. However, the later routines
-- are occasionally preferred in tool generated marshalling code.
unsafeForeignPtrToPtr (ForeignPtr fo r) = Ptr fo
unsafeForeignPtrToPtr (ForeignPtr fo _) = Ptr fo
castForeignPtr :: ForeignPtr a -> ForeignPtr b
-- ^This function casts a 'ForeignPtr'
......@@ -312,4 +314,6 @@ finalizeForeignPtr (ForeignPtr _ foreignPtr) = do
refFinalizers = case foreignPtr of
(PlainForeignPtr ref) -> ref
(MallocPtr _ ref) -> ref
PlainPtr _ ->
error "finalizeForeignPtr PlainPtr"
......@@ -140,7 +140,7 @@ bindIO (IO m) k = IO ( \ s ->
thenIO :: IO a -> IO b -> IO b
thenIO (IO m) k = IO ( \ s ->
case m s of
(# new_s, a #) -> unIO k new_s
(# new_s, _ #) -> unIO k new_s
)
returnIO :: a -> IO a
......@@ -471,15 +471,18 @@ data HandleType
| AppendHandle
| ReadWriteHandle
isReadableHandleType :: HandleType -> Bool
isReadableHandleType ReadHandle = True
isReadableHandleType ReadWriteHandle = True
isReadableHandleType _ = False
isWritableHandleType :: HandleType -> Bool
isWritableHandleType AppendHandle = True
isWritableHandleType WriteHandle = True
isWritableHandleType ReadWriteHandle = True
isWritableHandleType _ = False
isReadWriteHandleType :: HandleType -> Bool
isReadWriteHandleType ReadWriteHandle{} = True
isReadWriteHandleType _ = False
......@@ -583,7 +586,7 @@ instance Eq (IOArray i e) where
-- |Build a new 'IOArray'
newIOArray :: Ix i => (i,i) -> e -> IO (IOArray i e)
{-# INLINE newIOArray #-}
newIOArray lu init = stToIO $ do {marr <- newSTArray lu init; return (IOArray marr)}
newIOArray lu initial = stToIO $ do {marr <- newSTArray lu initial; return (IOArray marr)}
-- | Read a value from an 'IOArray'
unsafeReadIOArray :: Ix i => IOArray i e -> Int -> IO e
......@@ -612,7 +615,7 @@ writeIOArray (IOArray marr) i e = stToIO (writeSTArray marr i e)
-- than the derived one.
instance Show HandleType where
showsPrec p t =
showsPrec _ t =
case t of
ClosedHandle -> showString "closed"
SemiClosedHandle -> showString "semi-closed"
......@@ -622,9 +625,10 @@ instance Show HandleType where
ReadWriteHandle -> showString "read-writable"
instance Show Handle where
showsPrec p (FileHandle file _) = showHandle file
showsPrec p (DuplexHandle file _ _) = showHandle file
showsPrec _ (FileHandle file _) = showHandle file
showsPrec _ (DuplexHandle file _ _) = showHandle file
showHandle :: FilePath -> String -> String
showHandle file = showString "{handle: " . showString file . showString "}"
-- ------------------------------------------------------------------------
......@@ -1019,8 +1023,8 @@ evaluate a = IO $ \s -> case a `seq` () of () -> (# s, a #)
\begin{code}
assertError :: Addr# -> Bool -> a -> a
assertError str pred v
| pred = v
assertError str predicate v
| predicate = v
| otherwise = throw (AssertionFailed (untangle str "Assertion failed"))
{-
......
......@@ -117,9 +117,9 @@ instance Bounded Int8 where
maxBound = 0x7F
instance Ix Int8 where
range (m,n) = [m..n]
unsafeIndex b@(m,_) i = fromIntegral i - fromIntegral m
inRange (m,n) i = m <= i && i <= n
range (m,n) = [m..n]
unsafeIndex (m,_) i = fromIntegral i - fromIntegral m
inRange (m,n) i = m <= i && i <= n
instance Read Int8 where
readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]
......@@ -233,9 +233,9 @@ instance Bounded Int16 where
maxBound = 0x7FFF
instance Ix Int16 where
range (m,n) = [m..n]
unsafeIndex b@(m,_) i = fromIntegral i - fromIntegral m
inRange (m,n) i = m <= i && i <= n
range (m,n) = [m..n]
unsafeIndex (m,_) i = fromIntegral i - fromIntegral m
inRange (m,n) i = m <= i && i <= n
instance Read Int16 where
readsPrec p s = [(fromIntegral (x::Int), r) | (x, r) <- readsPrec p s]
......@@ -535,9 +535,9 @@ instance Bounded Int32 where
maxBound = 0x7FFFFFFF
instance Ix Int32 where
range (m,n) = [m..n]
unsafeIndex b@(m,_) i = fromIntegral i - fromIntegral m
inRange (m,n) i = m <= i && i <= n
range (m,n) = [m..n]
unsafeIndex (m,_) i = fromIntegral i - fromIntegral m
inRange (m,n) i = m <= i && i <= n
------------------------------------------------------------------------
-- type Int64
......@@ -787,7 +787,10 @@ instance Bits Int64 where
"fromIntegral/Int64->a" fromIntegral = \(I64# x#) -> fromIntegral (I# x#)
#-}
uncheckedIShiftL64# :: Int# -> Int# -> Int#
uncheckedIShiftL64# = uncheckedIShiftL#
uncheckedIShiftRA64# :: Int# -> Int# -> Int#
uncheckedIShiftRA64# = uncheckedIShiftRA#
#endif
......@@ -799,6 +802,6 @@ instance Bounded Int64 where
maxBound = 0x7FFFFFFFFFFFFFFF
instance Ix Int64 where
range (m,n) = [m..n]
unsafeIndex b@(m,_) i = fromIntegral i - fromIntegral m
inRange (m,n) i = m <= i && i <= n