summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorJan Stolarek <jan.stolarek@p.lodz.pl>2013-09-16 15:16:31 +0100
committerJan Stolarek <jan.stolarek@p.lodz.pl>2013-09-18 14:19:49 +0100
commitad89699497ee475c22a72d46d9569cd7769c57f6 (patch)
tree89bb9ce327990fa9377830c39f9884c72ab2b0dc /libraries
parentacb313ad780f547f55a8f549a368c445559932d2 (diff)
downloadhaskell-ad89699497ee475c22a72d46d9569cd7769c57f6.tar.gz
Follow changes in comparison primops (see #6135)
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/Control/Concurrent.hs2
-rw-r--r--libraries/base/Data/Bits.hs18
-rw-r--r--libraries/base/GHC/Arr.lhs10
-rw-r--r--libraries/base/GHC/Base.lhs44
-rw-r--r--libraries/base/GHC/Char.hs2
-rw-r--r--libraries/base/GHC/Conc/Sync.lhs9
-rw-r--r--libraries/base/GHC/Enum.lhs106
-rwxr-xr-xlibraries/base/GHC/Exts.hs3
-rw-r--r--libraries/base/GHC/Float.lhs48
-rw-r--r--libraries/base/GHC/Float/ConversionUtils.hs18
-rw-r--r--libraries/base/GHC/Float/RealFracMethods.hs50
-rw-r--r--libraries/base/GHC/IO/Exception.hs4
-rw-r--r--libraries/base/GHC/Int.hs68
-rw-r--r--libraries/base/GHC/List.lhs30
-rw-r--r--libraries/base/GHC/MVar.hs4
-rw-r--r--libraries/base/GHC/Real.lhs2
-rw-r--r--libraries/base/GHC/STRef.lhs2
-rw-r--r--libraries/base/GHC/Show.lhs18
-rw-r--r--libraries/base/GHC/Word.hs80
19 files changed, 262 insertions, 256 deletions
diff --git a/libraries/base/Control/Concurrent.hs b/libraries/base/Control/Concurrent.hs
index 7cc023ade0..25671bf1d8 100644
--- a/libraries/base/Control/Concurrent.hs
+++ b/libraries/base/Control/Concurrent.hs
@@ -326,7 +326,7 @@ forkOS action0
isCurrentThreadBound :: IO Bool
isCurrentThreadBound = IO $ \ s# ->
case isCurrentThreadBound# s# of
- (# s2#, flg #) -> (# s2#, not (flg ==# 0#) #)
+ (# s2#, flg #) -> (# s2#, isTrue# (flg /=# 0#) #)
{- |
diff --git a/libraries/base/Data/Bits.hs b/libraries/base/Data/Bits.hs
index 193a634cc4..fb71d75473 100644
--- a/libraries/base/Data/Bits.hs
+++ b/libraries/base/Data/Bits.hs
@@ -294,11 +294,11 @@ instance Bits Int where
complement (I# x#) = I# (word2Int# (int2Word# x# `xor#` int2Word# (-1#)))
(I# x#) `shift` (I# i#)
- | i# >=# 0# = I# (x# `iShiftL#` i#)
- | otherwise = I# (x# `iShiftRA#` negateInt# i#)
- (I# x#) `shiftL` (I# i#) = I# (x# `iShiftL#` i#)
+ | isTrue# (i# >=# 0#) = I# (x# `iShiftL#` i#)
+ | otherwise = I# (x# `iShiftRA#` negateInt# i#)
+ (I# x#) `shiftL` (I# i#) = I# (x# `iShiftL#` i#)
(I# x#) `unsafeShiftL` (I# i#) = I# (x# `uncheckedIShiftL#` i#)
- (I# x#) `shiftR` (I# i#) = I# (x# `iShiftRA#` i#)
+ (I# x#) `shiftR` (I# i#) = I# (x# `iShiftRA#` i#)
(I# x#) `unsafeShiftR` (I# i#) = I# (x# `uncheckedIShiftRA#` i#)
{-# INLINE rotate #-} -- See Note [Constant folding for rotate]
@@ -330,14 +330,14 @@ instance Bits Word where
complement (W# x#) = W# (x# `xor#` mb#)
where !(W# mb#) = maxBound
(W# x#) `shift` (I# i#)
- | i# >=# 0# = W# (x# `shiftL#` i#)
- | otherwise = W# (x# `shiftRL#` negateInt# i#)
- (W# x#) `shiftL` (I# i#) = W# (x# `shiftL#` i#)
+ | isTrue# (i# >=# 0#) = W# (x# `shiftL#` i#)
+ | otherwise = W# (x# `shiftRL#` negateInt# i#)
+ (W# x#) `shiftL` (I# i#) = W# (x# `shiftL#` i#)
(W# x#) `unsafeShiftL` (I# i#) = W# (x# `uncheckedShiftL#` i#)
- (W# x#) `shiftR` (I# i#) = W# (x# `shiftRL#` i#)
+ (W# x#) `shiftR` (I# i#) = W# (x# `shiftRL#` i#)
(W# x#) `unsafeShiftR` (I# i#) = W# (x# `uncheckedShiftRL#` i#)
(W# x#) `rotate` (I# i#)
- | i'# ==# 0# = W# x#
+ | isTrue# (i'# ==# 0#) = W# x#
| otherwise = W# ((x# `uncheckedShiftL#` i'#) `or#` (x# `uncheckedShiftRL#` (wsib -# i'#)))
where
!i'# = word2Int# (int2Word# i# `and#` int2Word# (wsib -# 1#))
diff --git a/libraries/base/GHC/Arr.lhs b/libraries/base/GHC/Arr.lhs
index 2be9878500..702c76d869 100644
--- a/libraries/base/GHC/Arr.lhs
+++ b/libraries/base/GHC/Arr.lhs
@@ -227,7 +227,7 @@ instance Ix Int where
| otherwise = indexError b i "Int"
{-# INLINE inRange #-}
- inRange (I# m,I# n) (I# i) = m <=# i && i <=# n
+ inRange (I# m,I# n) (I# i) = isTrue# (m <=# i) && isTrue# (i <=# n)
instance Ix Word where
range (m,n) = [m..n]
@@ -411,7 +411,7 @@ data STArray s i e
-- Just pointer equality on mutable arrays:
instance Eq (STArray s i e) where
STArray _ _ _ arr1# == STArray _ _ _ arr2# =
- sameMutableArray arr1# arr2#
+ isTrue# (sameMutableArray# arr1# arr2#)
\end{code}
@@ -509,7 +509,7 @@ listArray :: Ix i => (i,i) -> [e] -> Array i e
listArray (l,u) es = runST (ST $ \s1# ->
case safeRangeSize (l,u) of { n@(I# n#) ->
case newArray# n# arrEleBottom s1# of { (# s2#, marr# #) ->
- let fillFromList i# xs s3# | i# ==# n# = s3#
+ let fillFromList i# xs s3# | isTrue# (i# ==# n#) = s3#
| otherwise = case xs of
[] -> s3#
y:ys -> case writeArray# marr# i# y s3# of { s4# ->
@@ -816,7 +816,7 @@ unsafeWriteSTArray (STArray _ _ _ marr#) (I# i#) e = ST $ \s1# ->
freezeSTArray :: Ix i => STArray s i e -> ST s (Array i e)
freezeSTArray (STArray l u n@(I# n#) marr#) = ST $ \s1# ->
case newArray# n# arrEleBottom s1# of { (# s2#, marr'# #) ->
- let copy i# s3# | i# ==# n# = s3#
+ let copy i# s3# | isTrue# (i# ==# n#) = s3#
| otherwise =
case readArray# marr# i# s3# of { (# s4#, e #) ->
case writeArray# marr'# i# e s4# of { s5# ->
@@ -834,7 +834,7 @@ unsafeFreezeSTArray (STArray l u n marr#) = ST $ \s1# ->
thawSTArray :: Ix i => Array i e -> ST s (STArray s i e)
thawSTArray (Array l u n@(I# n#) arr#) = ST $ \s1# ->
case newArray# n# arrEleBottom s1# of { (# s2#, marr# #) ->
- let copy i# s3# | i# ==# n# = s3#
+ let copy i# s3# | isTrue# (i# ==# n#) = s3#
| otherwise =
case indexArray# arr# i# of { (# e #) ->
case writeArray# marr# i# e s3# of { s4# ->
diff --git a/libraries/base/GHC/Base.lhs b/libraries/base/GHC/Base.lhs
index ba2539cfa3..0958eb7f3f 100644
--- a/libraries/base/GHC/Base.lhs
+++ b/libraries/base/GHC/Base.lhs
@@ -16,10 +16,6 @@ GHC.Prim Has no implementation. It defines built-in things, and
The source file is GHC.Prim.hi-boot, which is just
copied to make GHC.Prim.hi
-GHC.PrimWrappers
- Provides wrappers for built-in comparison operators.
- These wrappers take unboxed operands and return a Bool.
-
GHC.Base Classes: Eq, Ord, Functor, Monad
Types: list, (), Int, Bool, Ordering, Char, String
@@ -105,8 +101,8 @@ module GHC.Base
module GHC.CString,
module GHC.Magic,
module GHC.Types,
- module GHC.Prim, -- Re-export GHC.Prim, GHC.PrimWrappers and
- module GHC.PrimWrappers,-- [boot] GHC.Err, to avoid lots of people having to
+ module GHC.Prim, -- Re-export GHC.Prim and [boot] GHC.Err,
+ -- to avoid lots of people having to
module GHC.Err -- import it explicitly
)
where
@@ -117,7 +113,6 @@ import GHC.CString
import GHC.Magic
import GHC.Prim
import GHC.Err
-import GHC.PrimWrappers
import {-# SOURCE #-} GHC.IO (failIO)
-- This is not strictly speaking required by this module, but is an
@@ -675,11 +670,14 @@ divModInt :: Int -> Int -> (Int, Int)
divModInt# :: Int# -> Int# -> (# Int#, Int# #)
x# `divModInt#` y#
- | (x# ># 0#) && (y# <# 0#) = case (x# -# 1#) `quotRemInt#` y# of
- (# q, r #) -> (# q -# 1#, r +# y# +# 1# #)
- | (x# <# 0#) && (y# ># 0#) = case (x# +# 1#) `quotRemInt#` y# of
- (# q, r #) -> (# q -# 1#, r +# y# -# 1# #)
- | otherwise = x# `quotRemInt#` y#
+ | isTrue# (x# ># 0#) && isTrue# (y# <# 0#) =
+ case (x# -# 1#) `quotRemInt#` y# of
+ (# q, r #) -> (# q -# 1#, r +# y# +# 1# #)
+ | isTrue# (x# <# 0#) && isTrue# (y# ># 0#) =
+ case (x# +# 1#) `quotRemInt#` y# of
+ (# q, r #) -> (# q -# 1#, r +# y# -# 1# #)
+ | otherwise =
+ x# `quotRemInt#` y#
-- Wrappers for the shift operations. The uncheckedShift# family are
-- undefined when the amount being shifted by is greater than the size
@@ -692,32 +690,34 @@ x# `divModInt#` y#
-- | Shift the argument left by the specified number of bits
-- (which must be non-negative).
shiftL# :: Word# -> Int# -> Word#
-a `shiftL#` b | b >=# WORD_SIZE_IN_BITS# = 0##
- | otherwise = a `uncheckedShiftL#` b
+a `shiftL#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0##
+ | otherwise = a `uncheckedShiftL#` b
-- | Shift the argument right by the specified number of bits
-- (which must be non-negative).
shiftRL# :: Word# -> Int# -> Word#
-a `shiftRL#` b | b >=# WORD_SIZE_IN_BITS# = 0##
- | otherwise = a `uncheckedShiftRL#` b
+a `shiftRL#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0##
+ | otherwise = a `uncheckedShiftRL#` b
-- | Shift the argument left by the specified number of bits
-- (which must be non-negative).
iShiftL# :: Int# -> Int# -> Int#
-a `iShiftL#` b | b >=# WORD_SIZE_IN_BITS# = 0#
- | otherwise = a `uncheckedIShiftL#` b
+a `iShiftL#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0#
+ | otherwise = a `uncheckedIShiftL#` b
-- | Shift the argument right (signed) by the specified number of bits
-- (which must be non-negative).
iShiftRA# :: Int# -> Int# -> Int#
-a `iShiftRA#` b | b >=# WORD_SIZE_IN_BITS# = if a <# 0# then (-1#) else 0#
- | otherwise = a `uncheckedIShiftRA#` b
+a `iShiftRA#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = if isTrue# (a <# 0#)
+ then (-1#)
+ else 0#
+ | otherwise = a `uncheckedIShiftRA#` b
-- | Shift the argument right (unsigned) by the specified number of bits
-- (which must be non-negative).
iShiftRL# :: Int# -> Int# -> Int#
-a `iShiftRL#` b | b >=# WORD_SIZE_IN_BITS# = 0#
- | otherwise = a `uncheckedIShiftRL#` b
+a `iShiftRL#` b | isTrue# (b >=# WORD_SIZE_IN_BITS#) = 0#
+ | otherwise = a `uncheckedIShiftRL#` b
-- Rules for C strings (the functions themselves are now in GHC.CString)
{-# RULES
diff --git a/libraries/base/GHC/Char.hs b/libraries/base/GHC/Char.hs
index 46661616b3..2db18c6c1d 100644
--- a/libraries/base/GHC/Char.hs
+++ b/libraries/base/GHC/Char.hs
@@ -9,7 +9,7 @@ import GHC.Show
-- | The 'Prelude.toEnum' method restricted to the type 'Data.Char.Char'.
chr :: Int -> Char
chr i@(I# i#)
- | int2Word# i# `leWord#` 0x10FFFF## = C# (chr# i#)
+ | isTrue# (int2Word# i# `leWord#` 0x10FFFF##) = C# (chr# i#)
| otherwise
= error ("Prelude.chr: bad argument: " ++ showSignedInt (I# 9#) i "")
diff --git a/libraries/base/GHC/Conc/Sync.lhs b/libraries/base/GHC/Conc/Sync.lhs
index 0feec12669..3020b0745d 100644
--- a/libraries/base/GHC/Conc/Sync.lhs
+++ b/libraries/base/GHC/Conc/Sync.lhs
@@ -431,8 +431,9 @@ runSparks :: IO ()
runSparks = IO loop
where loop s = case getSpark# s of
(# s', n, p #) ->
- if n ==# 0# then (# s', () #)
- else p `seq` loop s'
+ if isTrue# (n ==# 0#)
+ then (# s', () #)
+ else p `seq` loop s'
data BlockReason
= BlockedOnMVar
@@ -489,7 +490,7 @@ threadStatus (ThreadId t) = IO $ \s ->
threadCapability :: ThreadId -> IO (Int, Bool)
threadCapability (ThreadId t) = IO $ \s ->
case threadStatus# t s of
- (# s', _, cap#, locked# #) -> (# s', (I# cap#, locked# /=# 0#) #)
+ (# s', _, cap#, locked# #) -> (# s', (I# cap#, isTrue# (locked# /=# 0#)) #)
-- | make a weak pointer to a 'ThreadId'. It can be important to do
-- this if you want to hold a reference to a 'ThreadId' while still
@@ -670,7 +671,7 @@ data TVar a = TVar (TVar# RealWorld a)
deriving Typeable
instance Eq (TVar a) where
- (TVar tvar1#) == (TVar tvar2#) = sameTVar tvar1# tvar2#
+ (TVar tvar1#) == (TVar tvar2#) = isTrue# (sameTVar# tvar1# tvar2#)
-- |Create a new TVar holding a value supplied
newTVar :: a -> STM (TVar a)
diff --git a/libraries/base/GHC/Enum.lhs b/libraries/base/GHC/Enum.lhs
index cc103d206f..36f05ff9f1 100644
--- a/libraries/base/GHC/Enum.lhs
+++ b/libraries/base/GHC/Enum.lhs
@@ -355,11 +355,11 @@ instance Bounded Char where
instance Enum Char where
succ (C# c#)
- | not (ord# c# ==# 0x10FFFF#) = C# (chr# (ord# c# +# 1#))
- | otherwise = error ("Prelude.Enum.Char.succ: bad argument")
+ | isTrue# (ord# c# /=# 0x10FFFF#) = C# (chr# (ord# c# +# 1#))
+ | otherwise = error ("Prelude.Enum.Char.succ: bad argument")
pred (C# c#)
- | not (ord# c# ==# 0#) = C# (chr# (ord# c# -# 1#))
- | otherwise = error ("Prelude.Enum.Char.pred: bad argument")
+ | isTrue# (ord# c# /=# 0#) = C# (chr# (ord# c# -# 1#))
+ | otherwise = error ("Prelude.Enum.Char.pred: bad argument")
toEnum = chr
fromEnum = ord
@@ -393,45 +393,45 @@ instance Enum Char where
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#)
+ go x | isTrue# (x ># y) = n
+ | otherwise = C# (chr# x) `c` go (x +# 1#)
{-# NOINLINE [1] eftChar #-}
eftChar :: Int# -> Int# -> String
-eftChar x y | x ># y = []
- | otherwise = C# (chr# x) : eftChar (x +# 1#) y
+eftChar x y | isTrue# (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#
+ | isTrue# (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
{-# NOINLINE [1] efdChar #-}
efdChar :: Int# -> Int# -> String
efdChar x1 x2
- | delta >=# 0# = go_up_char_list x1 delta 0x10FFFF#
- | otherwise = go_dn_char_list x1 delta 0#
+ | isTrue# (delta >=# 0#) = go_up_char_list x1 delta 0x10FFFF#
+ | otherwise = go_dn_char_list x1 delta 0#
where
!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
+ | isTrue# (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
{-# NOINLINE [1] efdtChar #-}
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
+ | isTrue# (delta >=# 0#) = go_up_char_list x1 delta lim
+ | otherwise = go_dn_char_list x1 delta lim
where
!delta = x2 -# x1
@@ -439,29 +439,29 @@ 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_up x | isTrue# (x ># lim) = n
+ | otherwise = C# (chr# x) `c` go_up (x +# delta)
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_dn x | isTrue# (x <# lim) = n
+ | otherwise = C# (chr# x) `c` go_dn (x +# delta)
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_up x | isTrue# (x ># lim) = []
+ | otherwise = C# (chr# x) : go_up (x +# delta)
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)
+ go_dn x | isTrue# (x <# lim) = []
+ | otherwise = C# (chr# x) : go_dn (x +# delta)
\end{code}
@@ -520,17 +520,21 @@ instance Enum Int where
{-# NOINLINE [1] eftInt #-}
eftInt :: Int# -> Int# -> [Int]
-- [x1..x2]
-eftInt x0 y | x0 ># y = []
- | otherwise = go x0
+eftInt x0 y | isTrue# (x0 ># y) = []
+ | otherwise = go x0
where
- go x = I# x : if x ==# y then [] else go (x +# 1#)
+ go x = I# x : if isTrue# (x ==# y)
+ then []
+ else go (x +# 1#)
{-# INLINE [0] eftIntFB #-}
eftIntFB :: (Int -> r -> r) -> r -> Int# -> Int# -> r
-eftIntFB c n x0 y | x0 ># y = n
- | otherwise = go x0
+eftIntFB c n x0 y | isTrue# (x0 ># y) = n
+ | otherwise = go x0
where
- go x = I# x `c` if x ==# y then n else go (x +# 1#)
+ go x = I# x `c` if isTrue# (x ==# y)
+ then n
+ else go (x +# 1#)
-- Watch out for y=maxBound; hence ==, not >
-- Be very careful not to have more than one "c"
-- so that when eftInfFB is inlined we can inline
@@ -549,27 +553,27 @@ eftIntFB c n x0 y | x0 ># y = n
efdInt :: Int# -> Int# -> [Int]
-- [x1,x2..maxInt]
-efdInt x1 x2
- | x2 >=# x1 = case maxInt of I# y -> efdtIntUp x1 x2 y
- | otherwise = case minInt of I# y -> efdtIntDn x1 x2 y
+efdInt x1 x2
+ | isTrue# (x2 >=# x1) = case maxInt of I# y -> efdtIntUp x1 x2 y
+ | otherwise = case minInt of I# y -> efdtIntDn x1 x2 y
{-# NOINLINE [1] efdtInt #-}
efdtInt :: Int# -> Int# -> Int# -> [Int]
-- [x1,x2..y]
efdtInt x1 x2 y
- | x2 >=# x1 = efdtIntUp x1 x2 y
- | otherwise = efdtIntDn x1 x2 y
+ | isTrue# (x2 >=# x1) = efdtIntUp x1 x2 y
+ | otherwise = efdtIntDn x1 x2 y
{-# INLINE [0] efdtIntFB #-}
efdtIntFB :: (Int -> r -> r) -> r -> Int# -> Int# -> Int# -> r
efdtIntFB c n x1 x2 y
- | x2 >=# x1 = efdtIntUpFB c n x1 x2 y
- | otherwise = efdtIntDnFB c n x1 x2 y
+ | isTrue# (x2 >=# x1) = efdtIntUpFB c n x1 x2 y
+ | otherwise = efdtIntDnFB c n x1 x2 y
-- Requires x2 >= x1
efdtIntUp :: Int# -> Int# -> Int# -> [Int]
efdtIntUp x1 x2 y -- Be careful about overflow!
- | y <# x2 = if y <# x1 then [] else [I# x1]
+ | isTrue# (y <# x2) = if isTrue# (y <# x1) then [] else [I# x1]
| otherwise = -- Common case: x1 <= x2 <= y
let !delta = x2 -# x1 -- >= 0
!y' = y -# delta -- x1 <= y' <= y; hence y' is representable
@@ -577,14 +581,14 @@ efdtIntUp x1 x2 y -- Be careful about overflow!
-- Invariant: x <= y
-- Note that: z <= y' => z + delta won't overflow
-- so we are guaranteed not to overflow if/when we recurse
- go_up x | x ># y' = [I# x]
- | otherwise = I# x : go_up (x +# delta)
+ go_up x | isTrue# (x ># y') = [I# x]
+ | otherwise = I# x : go_up (x +# delta)
in I# x1 : go_up x2
-- Requires x2 >= x1
efdtIntUpFB :: (Int -> r -> r) -> r -> Int# -> Int# -> Int# -> r
efdtIntUpFB c n x1 x2 y -- Be careful about overflow!
- | y <# x2 = if y <# x1 then n else I# x1 `c` n
+ | isTrue# (y <# x2) = if isTrue# (y <# x1) then n else I# x1 `c` n
| otherwise = -- Common case: x1 <= x2 <= y
let !delta = x2 -# x1 -- >= 0
!y' = y -# delta -- x1 <= y' <= y; hence y' is representable
@@ -592,14 +596,14 @@ efdtIntUpFB c n x1 x2 y -- Be careful about overflow!
-- Invariant: x <= y
-- Note that: z <= y' => z + delta won't overflow
-- so we are guaranteed not to overflow if/when we recurse
- go_up x | x ># y' = I# x `c` n
- | otherwise = I# x `c` go_up (x +# delta)
+ go_up x | isTrue# (x ># y') = I# x `c` n
+ | otherwise = I# x `c` go_up (x +# delta)
in I# x1 `c` go_up x2
-- Requires x2 <= x1
efdtIntDn :: Int# -> Int# -> Int# -> [Int]
efdtIntDn x1 x2 y -- Be careful about underflow!
- | y ># x2 = if y ># x1 then [] else [I# x1]
+ | isTrue# (y ># x2) = if isTrue# (y ># x1) then [] else [I# x1]
| otherwise = -- Common case: x1 >= x2 >= y
let !delta = x2 -# x1 -- <= 0
!y' = y -# delta -- y <= y' <= x1; hence y' is representable
@@ -607,14 +611,14 @@ efdtIntDn x1 x2 y -- Be careful about underflow!
-- Invariant: x >= y
-- Note that: z >= y' => z + delta won't underflow
-- so we are guaranteed not to underflow if/when we recurse
- go_dn x | x <# y' = [I# x]
- | otherwise = I# x : go_dn (x +# delta)
+ go_dn x | isTrue# (x <# y') = [I# x]
+ | otherwise = I# x : go_dn (x +# delta)
in I# x1 : go_dn x2
-- Requires x2 <= x1
efdtIntDnFB :: (Int -> r -> r) -> r -> Int# -> Int# -> Int# -> r
efdtIntDnFB c n x1 x2 y -- Be careful about underflow!
- | y ># x2 = if y ># x1 then n else I# x1 `c` n
+ | isTrue# (y ># x2) = if isTrue# (y ># x1) then n else I# x1 `c` n
| otherwise = -- Common case: x1 >= x2 >= y
let !delta = x2 -# x1 -- <= 0
!y' = y -# delta -- y <= y' <= x1; hence y' is representable
@@ -622,8 +626,8 @@ efdtIntDnFB c n x1 x2 y -- Be careful about underflow!
-- Invariant: x >= y
-- Note that: z >= y' => z + delta won't underflow
-- so we are guaranteed not to underflow if/when we recurse
- go_dn x | x <# y' = I# x `c` n
- | otherwise = I# x `c` go_dn (x +# delta)
+ go_dn x | isTrue# (x <# y') = I# x `c` n
+ | otherwise = I# x `c` go_dn (x +# delta)
in I# x1 `c` go_dn x2
\end{code}
@@ -667,8 +671,8 @@ instance Enum Integer where
{-# INLINE enumFromThen #-}
{-# INLINE enumFromTo #-}
{-# INLINE enumFromThenTo #-}
- enumFrom x = enumDeltaInteger x 1
- enumFromThen x y = enumDeltaInteger x (y-x)
+ enumFrom x = enumDeltaInteger x 1
+ enumFromThen x y = enumDeltaInteger x (y-x)
enumFromTo x lim = enumDeltaToInteger x 1 lim
enumFromThenTo x y lim = enumDeltaToInteger x (y-x) lim
diff --git a/libraries/base/GHC/Exts.hs b/libraries/base/GHC/Exts.hs
index ec1c67d257..eee2509515 100755
--- a/libraries/base/GHC/Exts.hs
+++ b/libraries/base/GHC/Exts.hs
@@ -28,10 +28,10 @@ module GHC.Exts
-- * Primitive operations
module GHC.Prim,
- module GHC.PrimWrappers,
shiftL#, shiftRL#, iShiftL#, iShiftRA#, iShiftRL#,
uncheckedShiftL64#, uncheckedShiftRL64#,
uncheckedIShiftL64#, uncheckedIShiftRA64#,
+ isTrue#,
-- * Fusion
build, augment,
@@ -67,7 +67,6 @@ module GHC.Exts
import Prelude
import GHC.Prim
-import GHC.PrimWrappers
import GHC.Base
import GHC.Word
import GHC.Int
diff --git a/libraries/base/GHC/Float.lhs b/libraries/base/GHC/Float.lhs
index 3d653701e9..7a4f39af6c 100644
--- a/libraries/base/GHC/Float.lhs
+++ b/libraries/base/GHC/Float.lhs
@@ -220,12 +220,12 @@ instance Real Float where
toRational (F# x#) =
case decodeFloat_Int# x# of
(# m#, e# #)
- | e# >=# 0# ->
+ | isTrue# (e# >=# 0#) ->
(smallInteger m# `shiftLInteger` e#) :% 1
- | (int2Word# m# `and#` 1##) `eqWord#` 0## ->
+ | isTrue# ((int2Word# m# `and#` 1##) `eqWord#` 0##) ->
case elimZerosInt# m# (negateInt# e#) of
(# n, d# #) -> n :% shiftLInteger 1 d#
- | otherwise ->
+ | otherwise ->
smallInteger m# :% shiftLInteger 1 (negateInt# e#)
instance Fractional Float where
@@ -386,12 +386,12 @@ instance Real Double where
toRational (D# x#) =
case decodeDoubleInteger x# of
(# m, e# #)
- | e# >=# 0# ->
+ | isTrue# (e# >=# 0#) ->
shiftLInteger m e# :% 1
- | (integerToWord m `and#` 1##) `eqWord#` 0## ->
+ | isTrue# ((integerToWord m `and#` 1##) `eqWord#` 0##) ->
case elimZerosInteger m (negateInt# e#) of
(# n, d# #) -> n :% shiftLInteger 1 d#
- | otherwise ->
+ | otherwise ->
m :% shiftLInteger 1 (negateInt# e#)
instance Fractional Double where
@@ -939,12 +939,12 @@ fromRat'' :: RealFloat a => Int -> Int -> Integer -> Integer -> a
fromRat'' minEx@(I# me#) mantDigs@(I# md#) n d =
case integerLog2IsPowerOf2# d of
(# ld#, pw# #)
- | pw# ==# 0# ->
+ | isTrue# (pw# ==# 0#) ->
case integerLog2# n of
- ln# | ln# >=# (ld# +# me# -# 1#) ->
+ ln# | isTrue# (ln# >=# (ld# +# me# -# 1#)) ->
-- this means n/d >= 2^(minEx-1), i.e. we are guaranteed to get
-- a normalised number, round to mantDigs bits
- if ln# <# md#
+ if isTrue# (ln# <# md#)
then encodeFloat n (I# (negateInt# ld#))
else let n' = n `shiftR` (I# (ln# +# 1# -# md#))
n'' = case roundingMode# n (ln# -# md#) of
@@ -959,9 +959,9 @@ fromRat'' minEx@(I# me#) mantDigs@(I# md#) n d =
-- the exponent for encoding is always minEx-mantDigs
-- so we must shift right by (minEx-mantDigs) - (-ld)
case ld# +# (me# -# md#) of
- ld'# | ld'# <=# 0# -> -- we would shift left, so we don't shift
+ ld'# | isTrue# (ld'# <=# 0#) -> -- we would shift left, so we don't shift
encodeFloat n (I# ((me# -# md#) -# ld'#))
- | ld'# <=# ln# ->
+ | isTrue# (ld'# <=# ln#) ->
let n' = n `shiftR` (I# ld'#)
in case roundingMode# n (ld'# -# 1#) of
0# -> encodeFloat n' (minEx - mantDigs)
@@ -969,7 +969,7 @@ fromRat'' minEx@(I# me#) mantDigs@(I# md#) n d =
then encodeFloat n' (minEx-mantDigs)
else encodeFloat (n' + 1) (minEx-mantDigs)
_ -> encodeFloat (n' + 1) (minEx-mantDigs)
- | ld'# ># (ln# +# 1#) -> encodeFloat 0 0 -- result of shift < 0.5
+ | isTrue# (ld'# ># (ln# +# 1#)) -> encodeFloat 0 0 -- result of shift < 0.5
| otherwise -> -- first bit of n shifted to 0.5 place
case integerLog2IsPowerOf2# n of
(# _, 0# #) -> encodeFloat 0 0 -- round to even
@@ -1021,12 +1021,12 @@ negateFloat :: Float -> Float
negateFloat (F# x) = F# (negateFloat# x)
gtFloat, geFloat, eqFloat, neFloat, ltFloat, leFloat :: Float -> Float -> Bool
-gtFloat (F# x) (F# y) = gtFloat# x y
-geFloat (F# x) (F# y) = geFloat# x y
-eqFloat (F# x) (F# y) = eqFloat# x y
-neFloat (F# x) (F# y) = neFloat# x y
-ltFloat (F# x) (F# y) = ltFloat# x y
-leFloat (F# x) (F# y) = leFloat# x y
+gtFloat (F# x) (F# y) = isTrue# (gtFloat# x y)
+geFloat (F# x) (F# y) = isTrue# (geFloat# x y)
+eqFloat (F# x) (F# y) = isTrue# (eqFloat# x y)
+neFloat (F# x) (F# y) = isTrue# (neFloat# x y)
+ltFloat (F# x) (F# y) = isTrue# (ltFloat# x y)
+leFloat (F# x) (F# y) = isTrue# (leFloat# x y)
expFloat, logFloat, sqrtFloat :: Float -> Float
sinFloat, cosFloat, tanFloat :: Float -> Float
@@ -1061,12 +1061,12 @@ negateDouble :: Double -> Double
negateDouble (D# x) = D# (negateDouble# x)
gtDouble, geDouble, eqDouble, neDouble, leDouble, ltDouble :: Double -> Double -> Bool
-gtDouble (D# x) (D# y) = x >## y
-geDouble (D# x) (D# y) = x >=## y
-eqDouble (D# x) (D# y) = x ==## y
-neDouble (D# x) (D# y) = x /=## y
-ltDouble (D# x) (D# y) = x <## y
-leDouble (D# x) (D# y) = x <=## y
+gtDouble (D# x) (D# y) = isTrue# (x >## y)
+geDouble (D# x) (D# y) = isTrue# (x >=## y)
+eqDouble (D# x) (D# y) = isTrue# (x ==## y)
+neDouble (D# x) (D# y) = isTrue# (x /=## y)
+ltDouble (D# x) (D# y) = isTrue# (x <## y)
+leDouble (D# x) (D# y) = isTrue# (x <=## y)
double2Float :: Double -> Float
double2Float (D# x) = F# (double2Float# x)
diff --git a/libraries/base/GHC/Float/ConversionUtils.hs b/libraries/base/GHC/Float/ConversionUtils.hs
index ec2233c741..c7fcf8dcb4 100644
--- a/libraries/base/GHC/Float/ConversionUtils.hs
+++ b/libraries/base/GHC/Float/ConversionUtils.hs
@@ -41,9 +41,9 @@ toByte64# i = word2Int# (and# 255## (int2Word# (int64ToInt# i)))
elim64# :: Int64# -> Int# -> (# Integer, Int# #)
elim64# n e =
case zeroCount (toByte64# n) of
- t | e <=# t -> (# int64ToInteger (uncheckedIShiftRA64# n e), 0# #)
- | t <# 8# -> (# int64ToInteger (uncheckedIShiftRA64# n t), e -# t #)
- | otherwise -> elim64# (uncheckedIShiftRA64# n 8#) (e -# 8#)
+ t | isTrue# (e <=# t) -> (# int64ToInteger (uncheckedIShiftRA64# n e), 0# #)
+ | isTrue# (t <# 8#) -> (# int64ToInteger (uncheckedIShiftRA64# n t), e -# t #)
+ | otherwise -> elim64# (uncheckedIShiftRA64# n 8#) (e -# 8#)
#else
@@ -62,9 +62,9 @@ elimZerosInteger m e = elim64# (TO64 m) e
elimZerosInt# :: Int# -> Int# -> (# Integer, Int# #)
elimZerosInt# n e =
case zeroCount (toByte# n) of
- t | e <=# t -> (# smallInteger (uncheckedIShiftRA# n e), 0# #)
- | t <# 8# -> (# smallInteger (uncheckedIShiftRA# n t), e -# t #)
- | otherwise -> elimZerosInt# (uncheckedIShiftRA# n 8#) (e -# 8#)
+ t | isTrue# (e <=# t) -> (# smallInteger (uncheckedIShiftRA# n e), 0# #)
+ | isTrue# (t <# 8#) -> (# smallInteger (uncheckedIShiftRA# n t), e -# t #)
+ | otherwise -> elimZerosInt# (uncheckedIShiftRA# n 8#) (e -# 8#)
{-# INLINE zeroCount #-}
zeroCount :: Int# -> Int#
@@ -87,9 +87,11 @@ zeroCountArr =
case writeInt8Array# mba 0# 8# s1 of
s2 ->
let fillA step val idx st
- | idx <# 256# = case writeInt8Array# mba idx val st of
+ | isTrue# (idx <# 256#) =
+ case writeInt8Array# mba idx val st of
nx -> fillA step val (idx +# step) nx
- | step <# 256# = fillA (2# *# step) (val +# 1#) step st
+ | isTrue# (step <# 256#) =
+ fillA (2# *# step) (val +# 1#) step st
| otherwise = st
in case fillA 2# 0# 1# s2 of
s3 -> case unsafeFreezeByteArray# mba s3 of
diff --git a/libraries/base/GHC/Float/RealFracMethods.hs b/libraries/base/GHC/Float/RealFracMethods.hs
index 57ec1e820e..c072208fca 100644
--- a/libraries/base/GHC/Float/RealFracMethods.hs
+++ b/libraries/base/GHC/Float/RealFracMethods.hs
@@ -99,7 +99,7 @@ default ()
-- of performance.
properFractionFloatInt :: Float -> (Int, Float)
properFractionFloatInt (F# x) =
- if x `eqFloat#` 0.0#
+ if isTrue# (x `eqFloat#` 0.0#)
then (I# 0#, F# 0.0#)
else case float2Int# x of
n -> (I# n, F# (x `minusFloat#` int2Float# n))
@@ -109,14 +109,14 @@ properFractionFloatInt (F# x) =
floorFloatInt :: Float -> Int
floorFloatInt (F# x) =
case float2Int# x of
- n | x `ltFloat#` int2Float# n -> I# (n -# 1#)
- | otherwise -> I# n
+ n | isTrue# (x `ltFloat#` int2Float# n) -> I# (n -# 1#)
+ | otherwise -> I# n
ceilingFloatInt :: Float -> Int
ceilingFloatInt (F# x) =
case float2Int# x of
- n | int2Float# n `ltFloat#` x -> I# (n +# 1#)
- | otherwise -> I# n
+ n | isTrue# (int2Float# n `ltFloat#` x) -> I# (n +# 1#)
+ | otherwise -> I# n
roundFloatInt :: Float -> Int
roundFloatInt x = float2Int (c_rintFloat x)
@@ -137,10 +137,10 @@ properFractionFloatInteger :: Float -> (Integer, Float)
properFractionFloatInteger v@(F# x) =
case decodeFloat_Int# x of
(# m, e #)
- | e <# 0# ->
+ | isTrue# (e <# 0#) ->
case negateInt# e of
- s | s ># 23# -> (0, v)
- | m <# 0# ->
+ s | isTrue# (s ># 23#) -> (0, v)
+ | isTrue# (m <# 0#) ->
case negateInt# (negateInt# m `uncheckedIShiftRA#` s) of
k -> (smallInteger k,
case m -# (k `uncheckedIShiftL#` s) of
@@ -165,10 +165,10 @@ floorFloatInteger :: Float -> Integer
floorFloatInteger (F# x) =
case decodeFloat_Int# x of
(# m, e #)
- | e <# 0# ->
+ | isTrue# (e <# 0#) ->
case negateInt# e of
- s | s ># 23# -> if m <# 0# then (-1) else 0
- | otherwise -> smallInteger (m `uncheckedIShiftRA#` s)
+ s | isTrue# (s ># 23#) -> if isTrue# (m <# 0#) then (-1) else 0
+ | otherwise -> smallInteger (m `uncheckedIShiftRA#` s)
| otherwise -> shiftLInteger (smallInteger m) e
-- ceiling x = -floor (-x)
@@ -195,7 +195,7 @@ roundFloatInteger x = float2Integer (c_rintFloat x)
-- of performance.
properFractionDoubleInt :: Double -> (Int, Double)
properFractionDoubleInt (D# x) =
- if x ==## 0.0##
+ if isTrue# (x ==## 0.0##)
then (I# 0#, D# 0.0##)
else case double2Int# x of
n -> (I# n, D# (x -## int2Double# n))
@@ -205,14 +205,14 @@ properFractionDoubleInt (D# x) =
floorDoubleInt :: Double -> Int
floorDoubleInt (D# x) =
case double2Int# x of
- n | x <## int2Double# n -> I# (n -# 1#)
- | otherwise -> I# n
+ n | isTrue# (x <## int2Double# n) -> I# (n -# 1#)
+ | otherwise -> I# n
ceilingDoubleInt :: Double -> Int
ceilingDoubleInt (D# x) =
case double2Int# x of
- n | int2Double# n <## x -> I# (n +# 1#)
- | otherwise -> I# n
+ n | isTrue# (int2Double# n <## x) -> I# (n +# 1#)
+ | otherwise -> I# n
roundDoubleInt :: Double -> Int
roundDoubleInt x = double2Int (c_rintDouble x)
@@ -235,10 +235,10 @@ properFractionDoubleInteger :: Double -> (Integer, Double)
properFractionDoubleInteger v@(D# x) =
case decodeDoubleInteger x of
(# m, e #)
- | e <# 0# ->
+ | isTrue# (e <# 0#) ->
case negateInt# e of
- s | s ># 52# -> (0, v)
- | m < 0 ->
+ s | isTrue# (s ># 52#) -> (0, v)
+ | m < 0 ->
case TO64 (negateInteger m) of
n ->
case n `uncheckedIShiftRA64#` s of
@@ -269,10 +269,10 @@ floorDoubleInteger :: Double -> Integer
floorDoubleInteger (D# x) =
case decodeDoubleInteger x of
(# m, e #)
- | e <# 0# ->
+ | isTrue# (e <# 0#) ->
case negateInt# e of
- s | s ># 52# -> if m < 0 then (-1) else 0
- | otherwise ->
+ s | isTrue# (s ># 52#) -> if m < 0 then (-1) else 0
+ | otherwise ->
case TO64 m of
n -> FROM64 (n `uncheckedIShiftRA64#` s)
| otherwise -> shiftLInteger m e
@@ -314,7 +314,7 @@ double2Integer :: Double -> Integer
double2Integer (D# x) =
case decodeDoubleInteger x of
(# m, e #)
- | e <# 0# ->
+ | isTrue# (e <# 0#) ->
case TO64 m of
n -> FROM64 (n `uncheckedIShiftRA64#` negateInt# e)
| otherwise -> shiftLInteger m e
@@ -324,8 +324,8 @@ float2Integer :: Float -> Integer
float2Integer (F# x) =
case decodeFloat_Int# x of
(# m, e #)
- | e <# 0# -> smallInteger (m `uncheckedIShiftRA#` negateInt# e)
- | otherwise -> shiftLInteger (smallInteger m) e
+ | isTrue# (e <# 0#) -> smallInteger (m `uncheckedIShiftRA#` negateInt# e)
+ | otherwise -> shiftLInteger (smallInteger m) e
-- Foreign imports, the rounding is done faster in C when the value
-- isn't integral, so we call out for rounding. For values of large
diff --git a/libraries/base/GHC/IO/Exception.hs b/libraries/base/GHC/IO/Exception.hs
index ca47128ddc..6f374590df 100644
--- a/libraries/base/GHC/IO/Exception.hs
+++ b/libraries/base/GHC/IO/Exception.hs
@@ -273,8 +273,8 @@ data IOErrorType
| Interrupted
instance Eq IOErrorType where
- x == y = getTag x ==# getTag y
-
+ x == y = isTrue# (getTag x ==# getTag y)
+
instance Show IOErrorType where
showsPrec _ e =
showString $
diff --git a/libraries/base/GHC/Int.hs b/libraries/base/GHC/Int.hs
index 2cabb663a8..5d8264aebc 100644
--- a/libraries/base/GHC/Int.hs
+++ b/libraries/base/GHC/Int.hs
@@ -142,14 +142,14 @@ instance Bits Int8 where
(I8# x#) `xor` (I8# y#) = I8# (word2Int# (int2Word# x# `xor#` int2Word# y#))
complement (I8# x#) = I8# (word2Int# (int2Word# x# `xor#` int2Word# (-1#)))
(I8# x#) `shift` (I# i#)
- | i# >=# 0# = I8# (narrow8Int# (x# `iShiftL#` i#))
+ | isTrue# (i# >=# 0#) = I8# (narrow8Int# (x# `iShiftL#` i#))
| otherwise = I8# (x# `iShiftRA#` negateInt# i#)
- (I8# x#) `shiftL` (I# i#) = I8# (narrow8Int# (x# `iShiftL#` i#))
+ (I8# x#) `shiftL` (I# i#) = I8# (narrow8Int# (x# `iShiftL#` i#))
(I8# x#) `unsafeShiftL` (I# i#) = I8# (narrow8Int# (x# `uncheckedIShiftL#` i#))
- (I8# x#) `shiftR` (I# i#) = I8# (x# `iShiftRA#` i#)
+ (I8# x#) `shiftR` (I# i#) = I8# (x# `iShiftRA#` i#)
(I8# x#) `unsafeShiftR` (I# i#) = I8# (x# `uncheckedIShiftRA#` i#)
(I8# x#) `rotate` (I# i#)
- | i'# ==# 0#
+ | isTrue# (i'# ==# 0#)
= I8# x#
| otherwise
= I8# (narrow8Int# (word2Int# ((x'# `uncheckedShiftL#` i'#) `or#`
@@ -301,14 +301,14 @@ instance Bits Int16 where
(I16# x#) `xor` (I16# y#) = I16# (word2Int# (int2Word# x# `xor#` int2Word# y#))
complement (I16# x#) = I16# (word2Int# (int2Word# x# `xor#` int2Word# (-1#)))
(I16# x#) `shift` (I# i#)
- | i# >=# 0# = I16# (narrow16Int# (x# `iShiftL#` i#))
+ | isTrue# (i# >=# 0#) = I16# (narrow16Int# (x# `iShiftL#` i#))
| otherwise = I16# (x# `iShiftRA#` negateInt# i#)
- (I16# x#) `shiftL` (I# i#) = I16# (narrow16Int# (x# `iShiftL#` i#))
+ (I16# x#) `shiftL` (I# i#) = I16# (narrow16Int# (x# `iShiftL#` i#))
(I16# x#) `unsafeShiftL` (I# i#) = I16# (narrow16Int# (x# `uncheckedIShiftL#` i#))
- (I16# x#) `shiftR` (I# i#) = I16# (x# `iShiftRA#` i#)
+ (I16# x#) `shiftR` (I# i#) = I16# (x# `iShiftRA#` i#)
(I16# x#) `unsafeShiftR` (I# i#) = I16# (x# `uncheckedIShiftRA#` i#)
(I16# x#) `rotate` (I# i#)
- | i'# ==# 0#
+ | isTrue# (i'# ==# 0#)
= I16# x#
| otherwise
= I16# (narrow16Int# (word2Int# ((x'# `uncheckedShiftL#` i'#) `or#`
@@ -465,15 +465,15 @@ instance Bits Int32 where
(I32# x#) `xor` (I32# y#) = I32# (word2Int# (int2Word# x# `xor#` int2Word# y#))
complement (I32# x#) = I32# (word2Int# (int2Word# x# `xor#` int2Word# (-1#)))
(I32# x#) `shift` (I# i#)
- | i# >=# 0# = I32# (narrow32Int# (x# `iShiftL#` i#))
+ | isTrue# (i# >=# 0#) = I32# (narrow32Int# (x# `iShiftL#` i#))
| otherwise = I32# (x# `iShiftRA#` negateInt# i#)
- (I32# x#) `shiftL` (I# i#) = I32# (narrow32Int# (x# `iShiftL#` i#))
+ (I32# x#) `shiftL` (I# i#) = I32# (narrow32Int# (x# `iShiftL#` i#))
(I32# x#) `unsafeShiftL` (I# i#) =
I32# (narrow32Int# (x# `uncheckedIShiftL#` i#))
- (I32# x#) `shiftR` (I# i#) = I32# (x# `iShiftRA#` i#)
+ (I32# x#) `shiftR` (I# i#) = I32# (x# `iShiftRA#` i#)
(I32# x#) `unsafeShiftR` (I# i#) = I32# (x# `uncheckedIShiftRA#` i#)
(I32# x#) `rotate` (I# i#)
- | i'# ==# 0#
+ | isTrue# (i'# ==# 0#)
= I32# x#
| otherwise
= I32# (narrow32Int# (word2Int# ((x'# `uncheckedShiftL#` i'#) `or#`
@@ -553,14 +553,14 @@ data {-# CTYPE "HsInt64" #-} Int64 = I64# Int64# deriving( Typeable )
-- ^ 64-bit signed integer type
instance Eq Int64 where
- (I64# x#) == (I64# y#) = x# `eqInt64#` y#
- (I64# x#) /= (I64# y#) = x# `neInt64#` y#
+ (I64# x#) == (I64# y#) = isTrue# (x# `eqInt64#` y#)
+ (I64# x#) /= (I64# y#) = isTrue# (x# `neInt64#` y#)
instance Ord Int64 where
- (I64# x#) < (I64# y#) = x# `ltInt64#` y#
- (I64# x#) <= (I64# y#) = x# `leInt64#` y#
- (I64# x#) > (I64# y#) = x# `gtInt64#` y#
- (I64# x#) >= (I64# y#) = x# `geInt64#` y#
+ (I64# x#) < (I64# y#) = isTrue# (x# `ltInt64#` y#)
+ (I64# x#) <= (I64# y#) = isTrue# (x# `leInt64#` y#)
+ (I64# x#) > (I64# y#) = isTrue# (x# `gtInt64#` y#)
+ (I64# x#) >= (I64# y#) = isTrue# (x# `geInt64#` y#)
instance Show Int64 where
showsPrec p x = showsPrec p (toInteger x)
@@ -636,9 +636,9 @@ divInt64#, modInt64# :: Int64# -> Int64# -> Int64#
-- Define div in terms of quot, being careful to avoid overflow (#7233)
x# `divInt64#` y#
- | (x# `gtInt64#` zero) && (y# `ltInt64#` zero)
+ | isTrue# (x# `gtInt64#` zero) && isTrue# (y# `ltInt64#` zero)
= ((x# `minusInt64#` one) `quotInt64#` y#) `minusInt64#` one
- | (x# `ltInt64#` zero) && (y# `gtInt64#` zero)
+ | isTrue# (x# `ltInt64#` zero) && isTrue# (y# `gtInt64#` zero)
= ((x# `plusInt64#` one) `quotInt64#` y#) `minusInt64#` one
| otherwise
= x# `quotInt64#` y#
@@ -647,9 +647,9 @@ x# `divInt64#` y#
!one = intToInt64# 1#
x# `modInt64#` y#
- | (x# `gtInt64#` zero) && (y# `ltInt64#` zero) ||
- (x# `ltInt64#` zero) && (y# `gtInt64#` zero)
- = if r# `neInt64#` zero then r# `plusInt64#` y# else zero
+ | isTrue# (x# `gtInt64#` zero) && isTrue# (y# `ltInt64#` zero) ||
+ isTrue# (x# `ltInt64#` zero) && isTrue# (y# `gtInt64#` zero)
+ = if isTrue# (r# `neInt64#` zero) then r# `plusInt64#` y# else zero
| otherwise = r#
where
!zero = intToInt64# 0#
@@ -668,14 +668,14 @@ instance Bits Int64 where
(I64# x#) `xor` (I64# y#) = I64# (word64ToInt64# (int64ToWord64# x# `xor64#` int64ToWord64# y#))
complement (I64# x#) = I64# (word64ToInt64# (not64# (int64ToWord64# x#)))
(I64# x#) `shift` (I# i#)
- | i# >=# 0# = I64# (x# `iShiftL64#` i#)
+ | isTrue# (i# >=# 0#) = I64# (x# `iShiftL64#` i#)
| otherwise = I64# (x# `iShiftRA64#` negateInt# i#)
(I64# x#) `shiftL` (I# i#) = I64# (x# `iShiftL64#` i#)
(I64# x#) `unsafeShiftL` (I# i#) = I64# (x# `uncheckedIShiftL64#` i#)
(I64# x#) `shiftR` (I# i#) = I64# (x# `iShiftRA64#` i#)
(I64# x#) `unsafeShiftR` (I# i#) = I64# (x# `uncheckedIShiftRA64#` i#)
(I64# x#) `rotate` (I# i#)
- | i'# ==# 0#
+ | isTrue# (i'# ==# 0#)
= I64# x#
| otherwise
= I64# (word64ToInt64# ((x'# `uncheckedShiftL64#` i'#) `or64#`
@@ -698,12 +698,12 @@ instance Bits Int64 where
iShiftL64#, iShiftRA64# :: Int64# -> Int# -> Int64#
-a `iShiftL64#` b | b >=# 64# = intToInt64# 0#
- | otherwise = a `uncheckedIShiftL64#` b
+a `iShiftL64#` b | isTrue# (b >=# 64#) = intToInt64# 0#
+ | otherwise = a `uncheckedIShiftL64#` b
-a `iShiftRA64#` b | b >=# 64# = if a `ltInt64#` (intToInt64# 0#)
- then intToInt64# (-1#)
- else intToInt64# 0#
+a `iShiftRA64#` b | isTrue# (b >=# 64#) = if isTrue# (a `ltInt64#` (intToInt64# 0#))
+ then intToInt64# (-1#)
+ else intToInt64# 0#
| otherwise = a `uncheckedIShiftRA64#` b
{-# RULES
@@ -806,14 +806,14 @@ instance Bits Int64 where
(I64# x#) `xor` (I64# y#) = I64# (word2Int# (int2Word# x# `xor#` int2Word# y#))
complement (I64# x#) = I64# (word2Int# (int2Word# x# `xor#` int2Word# (-1#)))
(I64# x#) `shift` (I# i#)
- | i# >=# 0# = I64# (x# `iShiftL#` i#)
+ | isTrue# (i# >=# 0#) = I64# (x# `iShiftL#` i#)
| otherwise = I64# (x# `iShiftRA#` negateInt# i#)
- (I64# x#) `shiftL` (I# i#) = I64# (x# `iShiftL#` i#)
+ (I64# x#) `shiftL` (I# i#) = I64# (x# `iShiftL#` i#)
(I64# x#) `unsafeShiftL` (I# i#) = I64# (x# `uncheckedIShiftL#` i#)
- (I64# x#) `shiftR` (I# i#) = I64# (x# `iShiftRA#` i#)
+ (I64# x#) `shiftR` (I# i#) = I64# (x# `iShiftRA#` i#)
(I64# x#) `unsafeShiftR` (I# i#) = I64# (x# `uncheckedIShiftRA#` i#)
(I64# x#) `rotate` (I# i#)
- | i'# ==# 0#
+ | isTrue# (i'# ==# 0#)
= I64# x#
| otherwise
= I64# (word2Int# ((x'# `uncheckedShiftL#` i'#) `or#`
diff --git a/libraries/base/GHC/List.lhs b/libraries/base/GHC/List.lhs
index e24df51277..9315ecfe70 100644
--- a/libraries/base/GHC/List.lhs
+++ b/libraries/base/GHC/List.lhs
@@ -372,14 +372,14 @@ splitAt n xs = (take n xs, drop n xs)
#else /* hack away */
{-# RULES
-"take" [~1] forall n xs . take n xs = takeFoldr n xs
+"take" [~1] forall n xs . take n xs = takeFoldr n xs
"takeList" [1] forall n xs . foldr (takeFB (:) []) (takeConst []) xs n = takeUInt n xs
#-}
{-# INLINE takeFoldr #-}
takeFoldr :: Int -> [a] -> [a]
takeFoldr (I# n#) xs
- = build (\c nil -> if n# <=# 0# then nil else
+ = build (\c nil -> if isTrue# (n# <=# 0#) then nil else
foldr (takeFB c nil) (takeConst nil) xs n#)
{-# NOINLINE [0] takeConst #-}
@@ -390,8 +390,8 @@ takeConst x _ = x
{-# NOINLINE [0] takeFB #-}
takeFB :: (a -> b -> b) -> b -> a -> (Int# -> b) -> Int# -> b
-takeFB c n x xs m | m <=# 1# = x `c` n
- | otherwise = x `c` xs (m -# 1#)
+takeFB c n x xs m | isTrue# (m <=# 1#) = x `c` n
+ | otherwise = x `c` xs (m -# 1#)
{-# INLINE [0] take #-}
take (I# n#) xs = takeUInt n# xs
@@ -402,8 +402,8 @@ take (I# n#) xs = takeUInt n# xs
takeUInt :: Int# -> [b] -> [b]
takeUInt n xs
- | n >=# 0# = take_unsafe_UInt n xs
- | otherwise = []
+ | isTrue# (n >=# 0#) = take_unsafe_UInt n xs
+ | otherwise = []
take_unsafe_UInt :: Int# -> [b] -> [b]
take_unsafe_UInt 0# _ = []
@@ -414,8 +414,8 @@ take_unsafe_UInt m ls =
takeUInt_append :: Int# -> [b] -> [b] -> [b]
takeUInt_append n xs rs
- | n >=# 0# = take_unsafe_UInt_append n xs rs
- | otherwise = []
+ | isTrue# (n >=# 0#) = take_unsafe_UInt_append n xs rs
+ | otherwise = []
take_unsafe_UInt_append :: Int# -> [b] -> [b] -> [b]
take_unsafe_UInt_append 0# _ rs = rs
@@ -425,8 +425,8 @@ take_unsafe_UInt_append m ls rs =
(x:xs) -> x : take_unsafe_UInt_append (m -# 1#) xs rs
drop (I# n#) ls
- | n# <# 0# = ls
- | otherwise = drop# n# ls
+ | isTrue# (n# <# 0#) = ls
+ | otherwise = drop# n# ls
where
drop# :: Int# -> [a] -> [a]
drop# 0# xs = xs
@@ -434,8 +434,8 @@ drop (I# n#) ls
drop# m# (_:xs) = drop# (m# -# 1#) xs
splitAt (I# n#) ls
- | n# <# 0# = ([], ls)
- | otherwise = splitAt# n# ls
+ | isTrue# (n# <# 0#) = ([], ls)
+ | otherwise = splitAt# n# ls
where
splitAt# :: Int# -> [a] -> ([a], [a])
splitAt# 0# xs = ([], xs)
@@ -614,12 +614,12 @@ xs !! n | n < 0 = error "Prelude.!!: negative index"
-- The semantics is not quite the same for error conditions
-- in the more efficient version.
--
-xs !! (I# n0) | n0 <# 0# = error "Prelude.(!!): negative index\n"
- | otherwise = sub xs n0
+xs !! (I# n0) | isTrue# (n0 <# 0#) = error "Prelude.(!!): negative index\n"
+ | otherwise = sub xs n0
where
sub :: [a] -> Int# -> a
sub [] _ = error "Prelude.(!!): index too large\n"
- sub (y:ys) n = if n ==# 0#
+ sub (y:ys) n = if isTrue# (n ==# 0#)
then y
else sub ys (n -# 1#)
#endif
diff --git a/libraries/base/GHC/MVar.hs b/libraries/base/GHC/MVar.hs
index c5fc6760c9..314a440b55 100644
--- a/libraries/base/GHC/MVar.hs
+++ b/libraries/base/GHC/MVar.hs
@@ -45,7 +45,7 @@ as a a box, which may be empty or full.
-- pull in Eq (Mvar a) too, to avoid GHC.Conc being an orphan-instance module
instance Eq (MVar a) where
- (MVar mvar1#) == (MVar mvar2#) = sameMVar mvar1# mvar2#
+ (MVar mvar1#) == (MVar mvar2#) = isTrue# (sameMVar# mvar1# mvar2#)
{-
M-Vars are rendezvous points for concurrent threads. They begin
@@ -171,7 +171,7 @@ tryReadMVar (MVar m) = IO $ \ s ->
isEmptyMVar :: MVar a -> IO Bool
isEmptyMVar (MVar mv#) = IO $ \ s# ->
case isEmptyMVar# mv# s# of
- (# s2#, flg #) -> (# s2#, not (flg ==# 0#) #)
+ (# s2#, flg #) -> (# s2#, isTrue# (flg /=# 0#) #)
-- |Add a finalizer to an 'MVar' (GHC only). See "Foreign.ForeignPtr" and
-- "System.Mem.Weak" for more about finalizers.
diff --git a/libraries/base/GHC/Real.lhs b/libraries/base/GHC/Real.lhs
index 5cb79de713..0d2713f174 100644
--- a/libraries/base/GHC/Real.lhs
+++ b/libraries/base/GHC/Real.lhs
@@ -347,7 +347,7 @@ instance Integral Word where
| y /= 0 = (W# (x# `quotWord#` y#), W# (x# `remWord#` y#))
| otherwise = divZeroError
toInteger (W# x#)
- | i# >=# 0# = smallInteger i#
+ | isTrue# (i# >=# 0#) = smallInteger i#
| otherwise = wordToInteger x#
where
!i# = word2Int# x#
diff --git a/libraries/base/GHC/STRef.lhs b/libraries/base/GHC/STRef.lhs
index 6f0d1a6f64..05a91a6885 100644
--- a/libraries/base/GHC/STRef.lhs
+++ b/libraries/base/GHC/STRef.lhs
@@ -48,6 +48,6 @@ writeSTRef (STRef var#) val = ST $ \s1# ->
-- Just pointer equality on mutable references:
instance Eq (STRef s a) where
- STRef v1# == STRef v2# = sameMutVar v1# v2#
+ STRef v1# == STRef v2# = isTrue# (sameMutVar# v1# v2#)
\end{code}
diff --git a/libraries/base/GHC/Show.lhs b/libraries/base/GHC/Show.lhs
index bce3e73b53..cf308cbc55 100644
--- a/libraries/base/GHC/Show.lhs
+++ b/libraries/base/GHC/Show.lhs
@@ -210,7 +210,7 @@ instance Show Word where
showWord :: Word# -> ShowS
showWord w# cs
- | w# `ltWord#` 10## = C# (chr# (ord# '0'# +# word2Int# w#)) : cs
+ | isTrue# (w# `ltWord#` 10##) = C# (chr# (ord# '0'# +# word2Int# w#)) : cs
| otherwise = case chr# (ord# '0'# +# word2Int# (w# `remWord#` 10##)) of
c# ->
showWord (w# `quotWord#` 10##) (C# c# : cs)
@@ -425,20 +425,20 @@ Code specific for Ints.
-- lower-case hexadecimal digits.
intToDigit :: Int -> Char
intToDigit (I# i)
- | i >=# 0# && i <=# 9# = unsafeChr (ord '0' + I# i)
- | i >=# 10# && i <=# 15# = unsafeChr (ord 'a' + I# i - 10)
- | otherwise = error ("Char.intToDigit: not a digit " ++ show (I# i))
+ | isTrue# (i >=# 0#) && isTrue# (i <=# 9#) = unsafeChr (ord '0' + I# i)
+ | isTrue# (i >=# 10#) && isTrue# (i <=# 15#) = unsafeChr (ord 'a' + I# i - 10)
+ | otherwise = error ("Char.intToDigit: not a digit " ++ show (I# i))
showSignedInt :: Int -> Int -> ShowS
showSignedInt (I# p) (I# n) r
- | n <# 0# && p ># 6# = '(' : itos n (')' : r)
- | otherwise = itos n r
+ | isTrue# (n <# 0#) && isTrue# (p ># 6#) = '(' : itos n (')' : r)
+ | otherwise = itos n r
itos :: Int# -> String -> String
itos n# cs
- | n# <# 0# =
+ | isTrue# (n# <# 0#) =
let !(I# minInt#) = minInt in
- if n# ==# minInt#
+ if isTrue# (n# ==# minInt#)
-- negateInt# minInt overflows, so we can't do that:
then '-' : (case n# `quotRemInt#` 10# of
(# q, r #) ->
@@ -448,7 +448,7 @@ itos n# cs
where
itos' :: Int# -> String -> String
itos' x# cs'
- | x# <# 10# = C# (chr# (ord# '0'# +# x#)) : cs'
+ | isTrue# (x# <# 10#) = C# (chr# (ord# '0'# +# x#)) : cs'
| otherwise = case x# `quotRemInt#` 10# of
(# q, r #) ->
case chr# (ord# '0'# +# r) of
diff --git a/libraries/base/GHC/Word.hs b/libraries/base/GHC/Word.hs
index 47710118b5..1581c4a868 100644
--- a/libraries/base/GHC/Word.hs
+++ b/libraries/base/GHC/Word.hs
@@ -133,15 +133,15 @@ instance Bits Word8 where
complement (W8# x#) = W8# (x# `xor#` mb#)
where !(W8# mb#) = maxBound
(W8# x#) `shift` (I# i#)
- | i# >=# 0# = W8# (narrow8Word# (x# `shiftL#` i#))
+ | isTrue# (i# >=# 0#) = W8# (narrow8Word# (x# `shiftL#` i#))
| otherwise = W8# (x# `shiftRL#` negateInt# i#)
- (W8# x#) `shiftL` (I# i#) = W8# (narrow8Word# (x# `shiftL#` i#))
+ (W8# x#) `shiftL` (I# i#) = W8# (narrow8Word# (x# `shiftL#` i#))
(W8# x#) `unsafeShiftL` (I# i#) =
W8# (narrow8Word# (x# `uncheckedShiftL#` i#))
- (W8# x#) `shiftR` (I# i#) = W8# (x# `shiftRL#` i#)
+ (W8# x#) `shiftR` (I# i#) = W8# (x# `shiftRL#` i#)
(W8# x#) `unsafeShiftR` (I# i#) = W8# (x# `uncheckedShiftRL#` i#)
- (W8# x#) `rotate` (I# i#)
- | i'# ==# 0# = W8# x#
+ (W8# x#) `rotate` (I# i#)
+ | isTrue# (i'# ==# 0#) = W8# x#
| otherwise = W8# (narrow8Word# ((x# `uncheckedShiftL#` i'#) `or#`
(x# `uncheckedShiftRL#` (8# -# i'#))))
where
@@ -280,15 +280,15 @@ instance Bits Word16 where
complement (W16# x#) = W16# (x# `xor#` mb#)
where !(W16# mb#) = maxBound
(W16# x#) `shift` (I# i#)
- | i# >=# 0# = W16# (narrow16Word# (x# `shiftL#` i#))
+ | isTrue# (i# >=# 0#) = W16# (narrow16Word# (x# `shiftL#` i#))
| otherwise = W16# (x# `shiftRL#` negateInt# i#)
- (W16# x#) `shiftL` (I# i#) = W16# (narrow16Word# (x# `shiftL#` i#))
+ (W16# x#) `shiftL` (I# i#) = W16# (narrow16Word# (x# `shiftL#` i#))
(W16# x#) `unsafeShiftL` (I# i#) =
W16# (narrow16Word# (x# `uncheckedShiftL#` i#))
- (W16# x#) `shiftR` (I# i#) = W16# (x# `shiftRL#` i#)
+ (W16# x#) `shiftR` (I# i#) = W16# (x# `shiftRL#` i#)
(W16# x#) `unsafeShiftR` (I# i#) = W16# (x# `uncheckedShiftRL#` i#)
- (W16# x#) `rotate` (I# i#)
- | i'# ==# 0# = W16# x#
+ (W16# x#) `rotate` (I# i#)
+ | isTrue# (i'# ==# 0#) = W16# x#
| otherwise = W16# (narrow16Word# ((x# `uncheckedShiftL#` i'#) `or#`
(x# `uncheckedShiftRL#` (16# -# i'#))))
where
@@ -452,7 +452,7 @@ instance Integral Word32 where
| otherwise = divZeroError
toInteger (W32# x#)
#if WORD_SIZE_IN_BITS == 32
- | i# >=# 0# = smallInteger i#
+ | isTrue# (i# >=# 0#) = smallInteger i#
| otherwise = wordToInteger x#
where
!i# = word2Int# x#
@@ -471,16 +471,16 @@ instance Bits Word32 where
complement (W32# x#) = W32# (x# `xor#` mb#)
where !(W32# mb#) = maxBound
(W32# x#) `shift` (I# i#)
- | i# >=# 0# = W32# (narrow32Word# (x# `shiftL#` i#))
+ | isTrue# (i# >=# 0#) = W32# (narrow32Word# (x# `shiftL#` i#))
| otherwise = W32# (x# `shiftRL#` negateInt# i#)
- (W32# x#) `shiftL` (I# i#) = W32# (narrow32Word# (x# `shiftL#` i#))
+ (W32# x#) `shiftL` (I# i#) = W32# (narrow32Word# (x# `shiftL#` i#))
(W32# x#) `unsafeShiftL` (I# i#) =
W32# (narrow32Word# (x# `uncheckedShiftL#` i#))
- (W32# x#) `shiftR` (I# i#) = W32# (x# `shiftRL#` i#)
+ (W32# x#) `shiftR` (I# i#) = W32# (x# `shiftRL#` i#)
(W32# x#) `unsafeShiftR` (I# i#) = W32# (x# `uncheckedShiftRL#` i#)
- (W32# x#) `rotate` (I# i#)
- | i'# ==# 0# = W32# x#
- | otherwise = W32# (narrow32Word# ((x# `uncheckedShiftL#` i'#) `or#`
+ (W32# x#) `rotate` (I# i#)
+ | isTrue# (i'# ==# 0#) = W32# x#
+ | otherwise = W32# (narrow32Word# ((x# `uncheckedShiftL#` i'#) `or#`
(x# `uncheckedShiftRL#` (32# -# i'#))))
where
!i'# = word2Int# (int2Word# i# `and#` 31##)
@@ -543,14 +543,14 @@ data {-# CTYPE "HsWord64" #-} Word64 = W64# Word64#
-- ^ 64-bit unsigned integer type
instance Eq Word64 where
- (W64# x#) == (W64# y#) = x# `eqWord64#` y#
- (W64# x#) /= (W64# y#) = x# `neWord64#` y#
+ (W64# x#) == (W64# y#) = isTrue# (x# `eqWord64#` y#)
+ (W64# x#) /= (W64# y#) = isTrue# (x# `neWord64#` y#)
instance Ord Word64 where
- (W64# x#) < (W64# y#) = x# `ltWord64#` y#
- (W64# x#) <= (W64# y#) = x# `leWord64#` y#
- (W64# x#) > (W64# y#) = x# `gtWord64#` y#
- (W64# x#) >= (W64# y#) = x# `geWord64#` y#
+ (W64# x#) < (W64# y#) = isTrue# (x# `ltWord64#` y#)
+ (W64# x#) <= (W64# y#) = isTrue# (x# `leWord64#` y#)
+ (W64# x#) > (W64# y#) = isTrue# (x# `gtWord64#` y#)
+ (W64# x#) >= (W64# y#) = isTrue# (x# `geWord64#` y#)
instance Num Word64 where
(W64# x#) + (W64# y#) = W64# (int64ToWord64# (word64ToInt64# x# `plusInt64#` word64ToInt64# y#))
@@ -612,16 +612,16 @@ instance Bits Word64 where
(W64# x#) `xor` (W64# y#) = W64# (x# `xor64#` y#)
complement (W64# x#) = W64# (not64# x#)
(W64# x#) `shift` (I# i#)
- | i# >=# 0# = W64# (x# `shiftL64#` i#)
+ | isTrue# (i# >=# 0#) = W64# (x# `shiftL64#` i#)
| otherwise = W64# (x# `shiftRL64#` negateInt# i#)
- (W64# x#) `shiftL` (I# i#) = W64# (x# `shiftL64#` i#)
+ (W64# x#) `shiftL` (I# i#) = W64# (x# `shiftL64#` i#)
(W64# x#) `unsafeShiftL` (I# i#) = W64# (x# `uncheckedShiftL64#` i#)
- (W64# x#) `shiftR` (I# i#) = W64# (x# `shiftRL64#` i#)
+ (W64# x#) `shiftR` (I# i#) = W64# (x# `shiftRL64#` i#)
(W64# x#) `unsafeShiftR` (I# i#) = W64# (x# `uncheckedShiftRL64#` i#)
(W64# x#) `rotate` (I# i#)
- | i'# ==# 0# = W64# x#
- | otherwise = W64# ((x# `uncheckedShiftL64#` i'#) `or64#`
- (x# `uncheckedShiftRL64#` (64# -# i'#)))
+ | isTrue# (i'# ==# 0#) = W64# x#
+ | otherwise = W64# ((x# `uncheckedShiftL64#` i'#) `or64#`
+ (x# `uncheckedShiftRL64#` (64# -# i'#)))
where
!i'# = word2Int# (int2Word# i# `and#` 63##)
bitSizeMaybe i = Just (finiteBitSize i)
@@ -638,11 +638,11 @@ instance Bits Word64 where
shiftL64#, shiftRL64# :: Word64# -> Int# -> Word64#
-a `shiftL64#` b | b >=# 64# = wordToWord64# 0##
- | otherwise = a `uncheckedShiftL64#` b
+a `shiftL64#` b | isTrue# (b >=# 64#) = wordToWord64# 0##
+ | otherwise = a `uncheckedShiftL64#` b
-a `shiftRL64#` b | b >=# 64# = wordToWord64# 0##
- | otherwise = a `uncheckedShiftRL64#` b
+a `shiftRL64#` b | isTrue# (b >=# 64#) = wordToWord64# 0##
+ | otherwise = a `uncheckedShiftRL64#` b
{-# RULES
"fromIntegral/Int->Word64" fromIntegral = \(I# x#) -> W64# (int64ToWord64# (intToInt64# x#))
@@ -712,7 +712,7 @@ instance Integral Word64 where
| y /= 0 = (W64# (x# `quotWord#` y#), W64# (x# `remWord#` y#))
| otherwise = divZeroError
toInteger (W64# x#)
- | i# >=# 0# = smallInteger i#
+ | isTrue# (i# >=# 0#) = smallInteger i#
| otherwise = wordToInteger x#
where
!i# = word2Int# x#
@@ -728,16 +728,16 @@ instance Bits Word64 where
complement (W64# x#) = W64# (x# `xor#` mb#)
where !(W64# mb#) = maxBound
(W64# x#) `shift` (I# i#)
- | i# >=# 0# = W64# (x# `shiftL#` i#)
+ | isTrue# (i# >=# 0#) = W64# (x# `shiftL#` i#)
| otherwise = W64# (x# `shiftRL#` negateInt# i#)
- (W64# x#) `shiftL` (I# i#) = W64# (x# `shiftL#` i#)
+ (W64# x#) `shiftL` (I# i#) = W64# (x# `shiftL#` i#)
(W64# x#) `unsafeShiftL` (I# i#) = W64# (x# `uncheckedShiftL#` i#)
- (W64# x#) `shiftR` (I# i#) = W64# (x# `shiftRL#` i#)
+ (W64# x#) `shiftR` (I# i#) = W64# (x# `shiftRL#` i#)
(W64# x#) `unsafeShiftR` (I# i#) = W64# (x# `uncheckedShiftRL#` i#)
(W64# x#) `rotate` (I# i#)
- | i'# ==# 0# = W64# x#
- | otherwise = W64# ((x# `uncheckedShiftL#` i'#) `or#`
- (x# `uncheckedShiftRL#` (64# -# i'#)))
+ | isTrue# (i'# ==# 0#) = W64# x#
+ | otherwise = W64# ((x# `uncheckedShiftL#` i'#) `or#`
+ (x# `uncheckedShiftRL#` (64# -# i'#)))
where
!i'# = word2Int# (int2Word# i# `and#` 63##)
bitSizeMaybe i = Just (finiteBitSize i)