summaryrefslogtreecommitdiff
path: root/libraries/ghc-prim
diff options
context:
space:
mode:
authorTommy Bidne <tbidne@protonmail.com>2022-08-12 11:14:37 +1200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-09-01 12:01:20 -0400
commit31a8989a1d4aa5fe1e3ed0b2e789145bb64a8ba8 (patch)
treec776384a8b95b0fe9b0207df71c091ea3ad06a2b /libraries/ghc-prim
parent7d3a055d4df6842f8fbcfbc1ca96e2a45a47d351 (diff)
downloadhaskell-31a8989a1d4aa5fe1e3ed0b2e789145bb64a8ba8.tar.gz
Change Ord defaults per CLC proposal
Approved by CLC in https://github.com/haskell/core-libraries-committee/issues/24#issuecomment-1233331267
Diffstat (limited to 'libraries/ghc-prim')
-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