summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWander Hillen <wjw.hillen@gmail.com>2020-09-12 16:06:04 +0200
committerBen Gamari <ben@smart-cactus.org>2020-09-24 13:11:02 -0400
commit29fc00bc5dd53c7d4f10f468e2207790e26d56e7 (patch)
tree612dd61355d5e64b78b424003963af851c1c514b
parentb1c4116d2df21dcb2a6ac6b1b70a226286d54203 (diff)
downloadhaskell-29fc00bc5dd53c7d4f10f468e2207790e26d56e7.tar.gz
Export singleton function from Data.List
Data.OldList exports a monomorphized singleton function but it is not re-exported by Data.List. Adding the export to Data.List causes a conflict with a 14-year old function of the same name and type by SPJ in GHC.Utils.Misc. We can't just remove this function because that leads to a problems when building GHC with a stage0 compiler that does not have singleton in Data.List yet. We also can't hide the function in GHC.Utils.Misc since it is not possible to hide a function from a module if the module does not export the function. To work around this, all places where the Utils.Misc singleton was used now use a qualified version like Utils.singleton and in GHC.Utils.Misc we are very specific about which version we export. (cherry picked from commit e195dae6d959e2a9b1a22a2ca78db5955e1d7dea)
-rw-r--r--compiler/GHC/Builtin/Utils.hs4
-rw-r--r--compiler/GHC/Core/Rules.hs4
-rw-r--r--compiler/GHC/Iface/Recomp.hs4
-rw-r--r--compiler/GHC/Rename/Names.hs6
-rw-r--r--compiler/GHC/Tc/Gen/Sig.hs4
-rw-r--r--compiler/GHC/Types/Name/Reader.hs6
-rw-r--r--compiler/GHC/Utils/Misc.hs2
-rw-r--r--libraries/base/Data/List.hs1
m---------libraries/deepseq0
9 files changed, 16 insertions, 15 deletions
diff --git a/compiler/GHC/Builtin/Utils.hs b/compiler/GHC/Builtin/Utils.hs
index 9874edc9b7..8700f6c3f2 100644
--- a/compiler/GHC/Builtin/Utils.hs
+++ b/compiler/GHC/Builtin/Utils.hs
@@ -71,7 +71,7 @@ import GHC.Driver.Types
import GHC.Core.Class
import GHC.Core.TyCon
import GHC.Types.Unique.FM
-import GHC.Utils.Misc
+import GHC.Utils.Misc as Utils
import GHC.Builtin.Types.Literals ( typeNatTyCons )
import GHC.Hs.Doc
@@ -179,7 +179,7 @@ knownKeyNamesOkay all_names
| otherwise
= Just badNamesStr
where
- namesEnv = foldl' (\m n -> extendNameEnv_Acc (:) singleton m n n)
+ namesEnv = foldl' (\m n -> extendNameEnv_Acc (:) Utils.singleton m n n)
emptyUFM all_names
badNamesEnv = filterNameEnv (\ns -> ns `lengthExceeds` 1) namesEnv
badNamesPairs = nonDetUFMToList badNamesEnv
diff --git a/compiler/GHC/Core/Rules.hs b/compiler/GHC/Core/Rules.hs
index acfa93efaa..796425dae1 100644
--- a/compiler/GHC/Core/Rules.hs
+++ b/compiler/GHC/Core/Rules.hs
@@ -65,7 +65,7 @@ import GHC.Utils.Outputable
import GHC.Data.FastString
import GHC.Data.Maybe
import GHC.Data.Bag
-import GHC.Utils.Misc
+import GHC.Utils.Misc as Utils
import Data.List
import Data.Ord
import Control.Monad ( guard )
@@ -356,7 +356,7 @@ unionRuleBase rb1 rb2 = plusNameEnv_C (++) rb1 rb2
extendRuleBase :: RuleBase -> CoreRule -> RuleBase
extendRuleBase rule_base rule
- = extendNameEnv_Acc (:) singleton rule_base (ruleIdName rule) rule
+ = extendNameEnv_Acc (:) Utils.singleton rule_base (ruleIdName rule) rule
pprRuleBase :: RuleBase -> SDoc
pprRuleBase rules = pprUFM rules $ \rss ->
diff --git a/compiler/GHC/Iface/Recomp.hs b/compiler/GHC/Iface/Recomp.hs
index 58d9dd05af..d461dd3c97 100644
--- a/compiler/GHC/Iface/Recomp.hs
+++ b/compiler/GHC/Iface/Recomp.hs
@@ -34,7 +34,7 @@ import GHC.Data.Graph.Directed
import GHC.Types.SrcLoc
import GHC.Utils.Outputable as Outputable
import GHC.Types.Unique
-import GHC.Utils.Misc hiding ( eqListBy )
+import GHC.Utils.Misc as Utils hiding ( eqListBy )
import GHC.Data.Maybe
import GHC.Utils.Binary
import GHC.Utils.Fingerprint
@@ -1332,7 +1332,7 @@ mkOrphMap get_key decls
where
go (non_orphs, orphs) d
| NotOrphan occ <- get_key d
- = (extendOccEnv_Acc (:) singleton non_orphs occ d, orphs)
+ = (extendOccEnv_Acc (:) Utils.singleton non_orphs occ d, orphs)
| otherwise = (non_orphs, d:orphs)
-- -----------------------------------------------------------------------------
diff --git a/compiler/GHC/Rename/Names.hs b/compiler/GHC/Rename/Names.hs
index 79834614ac..f7a07c03e6 100644
--- a/compiler/GHC/Rename/Names.hs
+++ b/compiler/GHC/Rename/Names.hs
@@ -57,7 +57,7 @@ import GHC.Utils.Outputable as Outputable
import GHC.Data.Maybe
import GHC.Types.SrcLoc as SrcLoc
import GHC.Types.Basic ( TopLevelFlag(..), StringLiteral(..) )
-import GHC.Utils.Misc
+import GHC.Utils.Misc as Utils
import GHC.Data.FastString
import GHC.Data.FastString.Env
import GHC.Types.Id
@@ -1180,8 +1180,8 @@ mkChildEnv :: [GlobalRdrElt] -> NameEnv [GlobalRdrElt]
mkChildEnv gres = foldr add emptyNameEnv gres
where
add gre env = case gre_par gre of
- FldParent p _ -> extendNameEnv_Acc (:) singleton env p gre
- ParentIs p -> extendNameEnv_Acc (:) singleton env p gre
+ FldParent p _ -> extendNameEnv_Acc (:) Utils.singleton env p gre
+ ParentIs p -> extendNameEnv_Acc (:) Utils.singleton env p gre
NoParent -> env
findChildren :: NameEnv [a] -> Name -> [a]
diff --git a/compiler/GHC/Tc/Gen/Sig.hs b/compiler/GHC/Tc/Gen/Sig.hs
index 7de3832bb6..a0fdc7ab48 100644
--- a/compiler/GHC/Tc/Gen/Sig.hs
+++ b/compiler/GHC/Tc/Gen/Sig.hs
@@ -52,7 +52,7 @@ import GHC.Types.Name
import GHC.Types.Name.Env
import GHC.Utils.Outputable
import GHC.Types.SrcLoc
-import GHC.Utils.Misc( singleton )
+import GHC.Utils.Misc as Utils ( singleton )
import GHC.Data.Maybe( orElse )
import Data.Maybe( mapMaybe )
import Control.Monad( unless )
@@ -551,7 +551,7 @@ lookupPragEnv :: TcPragEnv -> Name -> [LSig GhcRn]
lookupPragEnv prag_fn n = lookupNameEnv prag_fn n `orElse` []
extendPragEnv :: TcPragEnv -> (Name, LSig GhcRn) -> TcPragEnv
-extendPragEnv prag_fn (n, sig) = extendNameEnv_Acc (:) singleton prag_fn n sig
+extendPragEnv prag_fn (n, sig) = extendNameEnv_Acc (:) Utils.singleton prag_fn n sig
---------------
mkPragEnv :: [LSig GhcRn] -> LHsBinds GhcRn -> TcPragEnv
diff --git a/compiler/GHC/Types/Name/Reader.hs b/compiler/GHC/Types/Name/Reader.hs
index b6f4bbce44..2cc5a3eb87 100644
--- a/compiler/GHC/Types/Name/Reader.hs
+++ b/compiler/GHC/Types/Name/Reader.hs
@@ -84,7 +84,7 @@ import GHC.Utils.Outputable
import GHC.Types.Unique
import GHC.Types.Unique.FM
import GHC.Types.Unique.Set
-import GHC.Utils.Misc
+import GHC.Utils.Misc as Utils
import GHC.Types.Name.Env
import Data.Data
@@ -959,7 +959,7 @@ mkGlobalRdrEnv :: [GlobalRdrElt] -> GlobalRdrEnv
mkGlobalRdrEnv gres
= foldr add emptyGlobalRdrEnv gres
where
- add gre env = extendOccEnv_Acc insertGRE singleton env
+ add gre env = extendOccEnv_Acc insertGRE Utils.singleton env
(greOccName gre)
gre
@@ -993,7 +993,7 @@ transformGREs trans_gre occs rdr_env
extendGlobalRdrEnv :: GlobalRdrEnv -> GlobalRdrElt -> GlobalRdrEnv
extendGlobalRdrEnv env gre
- = extendOccEnv_Acc insertGRE singleton env
+ = extendOccEnv_Acc insertGRE Utils.singleton env
(greOccName gre) gre
shadowNames :: GlobalRdrEnv -> [Name] -> GlobalRdrEnv
diff --git a/compiler/GHC/Utils/Misc.hs b/compiler/GHC/Utils/Misc.hs
index e0ef6abd0a..896606884e 100644
--- a/compiler/GHC/Utils/Misc.hs
+++ b/compiler/GHC/Utils/Misc.hs
@@ -42,7 +42,7 @@ module GHC.Utils.Misc (
listLengthCmp, atLength,
equalLength, compareLength, leLength, ltLength,
- isSingleton, only, singleton,
+ isSingleton, only, GHC.Utils.Misc.singleton,
notNull, snocView,
isIn, isn'tIn,
diff --git a/libraries/base/Data/List.hs b/libraries/base/Data/List.hs
index 4b839e954f..4474e51268 100644
--- a/libraries/base/Data/List.hs
+++ b/libraries/base/Data/List.hs
@@ -25,6 +25,7 @@ module Data.List
, tail
, init
, uncons
+ , singleton
, null
, length
diff --git a/libraries/deepseq b/libraries/deepseq
-Subproject b8c4fb4debaed6ef7eb6940ca4cfea6bd63cc21
+Subproject 13c1c84415da727ab56e9fa33aca5046b668384