[Git][ghc/ghc][master] Ord docs: Add explanation on 'min' and 'max' operator interactions
Marge Bot
gitlab at gitlab.haskell.org
Sun Apr 14 12:49:18 UTC 2019
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
d2271fe4 by Simon Jakobi at 2019-04-14T12:43:17Z
Ord docs: Add explanation on 'min' and 'max' operator interactions
[ci skip]
- - - - -
1 changed file:
- libraries/ghc-prim/GHC/Classes.hs
Changes:
=====================================
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.
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/d2271fe4e841cc157385bfc9ee498a0bf805f250
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/commit/d2271fe4e841cc157385bfc9ee498a0bf805f250
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20190414/d15510db/attachment.html>
More information about the ghc-commits
mailing list