diff options
| author | simonpj <unknown> | 1999-05-28 19:21:34 +0000 |
|---|---|---|
| committer | simonpj <unknown> | 1999-05-28 19:21:34 +0000 |
| commit | 29ad936c0443b6af87c26e19d61d1352ac5e7f3e (patch) | |
| tree | 7997c469cf4e9316f348f59212947ea891da888c | |
| parent | c713132029e30d869f561a3657f71729a3697c80 (diff) | |
| download | haskell-29ad936c0443b6af87c26e19d61d1352ac5e7f3e.tar.gz | |
[project @ 1999-05-28 19:21:34 by simonpj]
Make the default instance for Ord such that it suffices to define <=, as claimed
| -rw-r--r-- | ghc/lib/std/PrelBase.lhs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ghc/lib/std/PrelBase.lhs b/ghc/lib/std/PrelBase.lhs index 9cd1c88a26..744f8a6fdc 100644 --- a/ghc/lib/std/PrelBase.lhs +++ b/ghc/lib/std/PrelBase.lhs @@ -30,7 +30,7 @@ infixr 0 $ %********************************************************* %* * -\subsection{Standard classes @Eq@, @Ord@, @Bounded@ +\subsection{Standard classes @Eq@, @Ord@} %* * %********************************************************* @@ -50,7 +50,9 @@ class (Eq a) => Ord a where -- Using compare can be more efficient for complex types. compare x y | x == y = EQ - | x < y = LT + | x <= y = LT -- NB: must be '<=' not '<' to validate the + -- above claim about the minimal things that can + -- be defined for an instance of Ord | otherwise = GT x <= y = case compare x y of { GT -> False; other -> True } @@ -241,7 +243,7 @@ some programs may get away without consulting PrelTup). Furthermore, the renamer currently *always* asks for () to be in scope, so that ccalls can use () as their default type; so when compiling PrelBase we need (). (We could arrange suck in () only if -fglasgow-exts, but putting -it here seems more direct. +it here seems more direct.) \begin{code} data () = () |
