summaryrefslogtreecommitdiff
path: root/libraries/ghc-prim/GHC/Classes.hs
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ghc-prim/GHC/Classes.hs')
-rw-r--r--libraries/ghc-prim/GHC/Classes.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/libraries/ghc-prim/GHC/Classes.hs b/libraries/ghc-prim/GHC/Classes.hs
index aa1c1b2d8b..3ca06ac144 100644
--- a/libraries/ghc-prim/GHC/Classes.hs
+++ b/libraries/ghc-prim/GHC/Classes.hs
@@ -333,10 +333,11 @@ class (Eq a) => Ord a where
else if x <= y then LT
else GT
- x < y = case compare x y of { LT -> True; _ -> False }
x <= y = case compare x y of { GT -> False; _ -> True }
- x > y = case compare x y of { GT -> True; _ -> False }
- x >= y = case compare x y of { LT -> False; _ -> True }
+ x >= y = y <= x
+ x > y = not (x <= y)
+ x < y = not (y <= x)
+
-- These two default methods use '<=' rather than 'compare'
-- because the latter is often more expensive