-- Using compare can be more efficient for complex types.
compare x y
| x == y = EQ
- | x <= y = LT
+ | x < y = LT
| otherwise = GT
x <= y = case compare x y of { GT -> False; other -> True }
zeroInt = I# 0#
oneInt = I# 1#
twoInt = I# 2#
-maxInt = I# (-2147483648#) -- GHC <= 2.09 had this at -2147483647
-minInt = I# 2147483647#
+minInt = I# (-2147483648#) -- GHC <= 2.09 had this at -2147483647
+maxInt = I# 2147483647#
instance Eq Int where
(==) x y = x `eqInt` y
enumFromTo (I# x) (I# y) = build (\ c n -> eftIntFB c n x y)
{-# INLINE enumFromThen #-}
- enumFromThen (I# x1) (I# x2) = build (\ c n -> efdtIntFB c n x1 x2 2147483647#)
+ enumFromThen (I# x1) (I# x2) = build (\ c n -> efdIntFB c n x1 x2)
{-# INLINE enumFromThenTo #-}
enumFromThenTo (I# x1) (I# x2) (I# y) = build (\ c n -> efdtIntFB c n x1 x2 y)
go_dn x | y -# x ># delta = [I# x]
| otherwise = I# x : go_dn (x +# delta)
+efdIntFB c n x1 x2
+ | delta >=# 0# = go_up x1
+ | otherwise = go_dn x1
+ where
+ delta = x2 -# x1
+ go_up x | 2147483647# -# x <# delta = I# x `c` n
+ | otherwise = I# x `c` go_up (x +# delta)
+ go_dn x | (-2147483648#) -# x ># delta = I# x `c` n
+ | otherwise = I# x `c` go_dn (x +# delta)
+
+efdIntList x1 x2
+ | delta >=# 0# = go_up x1
+ | otherwise = go_dn x1
+ where
+ delta = x2 -# x1
+ go_up x | 2147483647# -# x <# delta = [I# x]
+ | otherwise = I# x : go_up (x +# delta)
+ go_dn x | (-2147483648#) -# x ># delta = [I# x]
+ | otherwise = I# x : go_dn (x +# delta)
+
{-# RULES
"eftIntList" eftIntFB (:) [] = eftIntList
+"efdIntList" efdIntFB (:) [] = efdIntList
"efdtIntList" efdtIntFB (:) [] = efdtIntList
#-}
\end{code}
foldr2_right k z y r [] = z
foldr2_right k z y r (x:xs) = k x y (r xs)
--- foldr2 k z xs ys = foldr (foldr2_left k z) z xs ys
--- foldr2 k z xs ys = foldr (foldr2_right k z) z ys xs
+-- foldr2 k z xs ys = foldr (foldr2_left k z) (\_ -> z) xs ys
+-- foldr2 k z xs ys = foldr (foldr2_right k z) (\_ -> z) ys xs
{-# RULES
"foldr2/left" forall k,z,ys,g::forall b.(a->b->b)->b->b .
foldr2 k z (build g) ys = g (foldr2_left k z) (\_ -> z) ys
instance Show Ordering where
showsPrec _ LT = showString "LT"
showsPrec _ EQ = showString "EQ"
- showsPrec _ GT = showString "EQ"
+ showsPrec _ GT = showString "GT"
instance Show Char where
showsPrec _ '\'' = showString "'\\''"