summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Jakobi <simon.jakobi@gmail.com>2019-04-10 09:23:49 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2019-04-14 08:43:17 -0400
commitd2271fe4e841cc157385bfc9ee498a0bf805f250 (patch)
treeb888a50134239ff5bc74c059317b4051fcc93555
parent6094d43f36bdab5ff3f246afca9a6018545fdd73 (diff)
downloadhaskell-d2271fe4e841cc157385bfc9ee498a0bf805f250.tar.gz
Ord docs: Add explanation on 'min' and 'max' operator interactions
[ci skip]
-rw-r--r--libraries/ghc-prim/GHC/Classes.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/libraries/ghc-prim/GHC/Classes.hs b/libraries/ghc-prim/GHC/Classes.hs
index 14e7ae37b0..6e12ce9a37 100644
--- a/libraries/ghc-prim/GHC/Classes.hs
+++ b/libraries/ghc-prim/GHC/Classes.hs
@@ -331,6 +331,10 @@ instance Ord TyCon where
-- 7. @min x y == if x <= y then x else y@ = 'True'
-- 8. @max x y == if x >= y then x else y@ = 'True'
--
+-- Note that (7.) and (8.) do /not/ require 'min' and 'max' to return either of
+-- their arguments. The result is merely required to /equal/ one of the
+-- arguments in terms of '(==)'.
+--
-- Minimal complete definition: either 'compare' or '<='.
-- Using 'compare' can be more efficient for complex types.
--