summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2015-09-09 10:18:18 +0200
committerJoachim Breitner <mail@joachim-breitner.de>2015-09-09 10:18:18 +0200
commit25d72fbf45903da0b65fccfd3853c7a7ecc06b57 (patch)
treea10105ab1515c118b13d6d709353660be2f4fc2a
parentc07fd1dc37aae27a118fafd482dab52ba4946cb3 (diff)
downloadhaskell-wip/T10858.tar.gz
Move thenCmp to GHC.Classeswip/T10858
as we need to derive code already that, and that happens before GHC.Base.
-rw-r--r--compiler/prelude/PrelNames.hs7
-rw-r--r--libraries/base/GHC/Base.hs6
-rw-r--r--libraries/ghc-prim/GHC/Classes.hs9
3 files changed, 11 insertions, 11 deletions
diff --git a/compiler/prelude/PrelNames.hs b/compiler/prelude/PrelNames.hs
index 597ef17aed..1515a2ff8e 100644
--- a/compiler/prelude/PrelNames.hs
+++ b/compiler/prelude/PrelNames.hs
@@ -611,11 +611,11 @@ compose_RDR :: RdrName
compose_RDR = varQual_RDR gHC_BASE (fsLit ".")
not_RDR, getTag_RDR, succ_RDR, pred_RDR, minBound_RDR, maxBound_RDR,
- and_RDR, or_RDR, range_RDR, inRange_RDR, index_RDR,
+ and_RDR, thenCmp_RDR, range_RDR, inRange_RDR, index_RDR,
unsafeIndex_RDR, unsafeRangeSize_RDR :: RdrName
and_RDR = varQual_RDR gHC_CLASSES (fsLit "&&")
-or_RDR = varQual_RDR gHC_CLASSES (fsLit "||")
not_RDR = varQual_RDR gHC_CLASSES (fsLit "not")
+thenCmp_RDR = varQual_RDR gHC_CLASSES (fsLit "thenCmp")
getTag_RDR = varQual_RDR gHC_BASE (fsLit "getTag")
succ_RDR = varQual_RDR gHC_ENUM (fsLit "succ")
pred_RDR = varQual_RDR gHC_ENUM (fsLit "pred")
@@ -725,7 +725,7 @@ notAssocDataCon_RDR = dataQual_RDR gHC_GENERICS (fsLit "NotAssociative")
fmap_RDR, pure_RDR, ap_RDR, foldable_foldr_RDR, foldMap_RDR,
- traverse_RDR, mempty_RDR, mappend_RDR, thenCmp_RDR :: RdrName
+ traverse_RDR, mempty_RDR, mappend_RDR :: RdrName
fmap_RDR = varQual_RDR gHC_BASE (fsLit "fmap")
pure_RDR = nameRdrName pureAName
ap_RDR = nameRdrName apAName
@@ -734,7 +734,6 @@ foldMap_RDR = varQual_RDR dATA_FOLDABLE (fsLit "foldMap")
traverse_RDR = varQual_RDR dATA_TRAVERSABLE (fsLit "traverse")
mempty_RDR = varQual_RDR gHC_BASE (fsLit "mempty")
mappend_RDR = varQual_RDR gHC_BASE (fsLit "mappend")
-thenCmp_RDR = varQual_RDR gHC_BASE (fsLit "thenCmp")
----------------------
varQual_RDR, tcQual_RDR, clsQual_RDR, dataQual_RDR
diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs
index 5d48d520f5..816c8d6355 100644
--- a/libraries/base/GHC/Base.hs
+++ b/libraries/base/GHC/Base.hs
@@ -290,12 +290,6 @@ instance Monoid Ordering where
mempty = EQ
mappend = thenCmp
--- The monomorphic version is used by the autogenerated Ord instances
-thenCmp :: Ordering -> Ordering -> Ordering
-LT `thenCmp` _ = LT
-EQ `thenCmp` y = y
-GT `thenCmp` _ = GT
-
-- | Lift a semigroup into 'Maybe' forming a 'Monoid' according to
-- <http://en.wikipedia.org/wiki/Monoid>: \"Any semigroup @S@ may be
-- turned into a monoid simply by adjoining an element @e@ not in @S@
diff --git a/libraries/ghc-prim/GHC/Classes.hs b/libraries/ghc-prim/GHC/Classes.hs
index 18662ad539..299a8720a9 100644
--- a/libraries/ghc-prim/GHC/Classes.hs
+++ b/libraries/ghc-prim/GHC/Classes.hs
@@ -32,7 +32,8 @@ module GHC.Classes(
Eq(..), eqInt, neInt,
Ord(..), gtInt, geInt, leInt, ltInt, compareInt, compareInt#,
(&&), (||), not,
- divInt#, modInt#
+ divInt#, modInt#,
+ thenCmp
) where
-- GHC.Magic is used in some derived instances
@@ -296,6 +297,12 @@ not :: Bool -> Bool
not True = False
not False = True
+-- This is used by the derived code for Ord, so put it here
+thenCmp :: Ordering -> Ordering -> Ordering
+LT `thenCmp` _ = LT
+EQ `thenCmp` y = y
+GT `thenCmp` _ = GT
+
------------------------------------------------------------------------
-- These don't really belong here, but we don't have a better place to