[commit: ghc] master: Fix deprecation warnings from containers (d2cf5de)
git at git.haskell.org
git at git.haskell.org
Mon Jan 30 17:03:13 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/d2cf5dea70acbffb6039dc5eda31c8ff03b8f43e/ghc
>---------------------------------------------------------------
commit d2cf5dea70acbffb6039dc5eda31c8ff03b8f43e
Author: Erik de Castro Lopo <erik.decastrolopo at ambiata.com>
Date: Mon Jan 30 11:47:00 2017 -0500
Fix deprecation warnings from containers
The functions that were causing warnings were deprecated in containers
0.5 and GHC is already using containers 0.5.9.1.
Test Plan: validate
Reviewers: rwbarton, bgamari, hsyl20, austin, dfeuer
Reviewed By: dfeuer
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3036
>---------------------------------------------------------------
d2cf5dea70acbffb6039dc5eda31c8ff03b8f43e
compiler/coreSyn/TrieMap.hs | 8 ++++----
compiler/simplCore/FloatOut.hs | 4 ++--
compiler/utils/FiniteMap.hs | 2 +-
compiler/utils/UniqDFM.hs | 4 ++--
compiler/utils/UniqFM.hs | 10 +++++-----
5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/compiler/coreSyn/TrieMap.hs b/compiler/coreSyn/TrieMap.hs
index f8546d1..4a6e245 100644
--- a/compiler/coreSyn/TrieMap.hs
+++ b/compiler/coreSyn/TrieMap.hs
@@ -119,7 +119,7 @@ instance TrieMap IntMap.IntMap where
emptyTM = IntMap.empty
lookupTM k m = IntMap.lookup k m
alterTM = xtInt
- foldTM k m z = IntMap.fold k z m
+ foldTM k m z = IntMap.foldr k z m
mapTM f m = IntMap.map f m
xtInt :: Int -> XT a -> IntMap.IntMap a -> IntMap.IntMap a
@@ -130,7 +130,7 @@ instance Ord k => TrieMap (Map.Map k) where
emptyTM = Map.empty
lookupTM = Map.lookup
alterTM k f m = Map.alter f k m
- foldTM k m z = Map.fold k z m
+ foldTM k m z = Map.foldr k z m
mapTM f m = Map.map f m
@@ -939,8 +939,8 @@ xtTyLit l f m =
StrTyLit n -> m { tlm_string = tlm_string m |> Map.alter f n }
foldTyLit :: (a -> b -> b) -> TyLitMap a -> b -> b
-foldTyLit l m = flip (Map.fold l) (tlm_string m)
- . flip (Map.fold l) (tlm_number m)
+foldTyLit l m = flip (Map.foldr l) (tlm_string m)
+ . flip (Map.foldr l) (tlm_number m)
-------------------------------------------------
-- | @TypeMap a@ is a map from 'Type' to @a at . If you are a client, this
diff --git a/compiler/simplCore/FloatOut.hs b/compiler/simplCore/FloatOut.hs
index 3c220fe..475108c 100644
--- a/compiler/simplCore/FloatOut.hs
+++ b/compiler/simplCore/FloatOut.hs
@@ -497,10 +497,10 @@ addTopFloatPairs float_bag prs
add (Rec prs1) prs2 = prs1 ++ prs2
flattenMajor :: MajorEnv -> Bag FloatBind
-flattenMajor = M.fold (unionBags . flattenMinor) emptyBag
+flattenMajor = M.foldr (unionBags . flattenMinor) emptyBag
flattenMinor :: MinorEnv -> Bag FloatBind
-flattenMinor = M.fold unionBags emptyBag
+flattenMinor = M.foldr unionBags emptyBag
emptyFloats :: FloatBinds
emptyFloats = FB emptyBag M.empty
diff --git a/compiler/utils/FiniteMap.hs b/compiler/utils/FiniteMap.hs
index dccfca1..cb6e557 100644
--- a/compiler/utils/FiniteMap.hs
+++ b/compiler/utils/FiniteMap.hs
@@ -24,6 +24,6 @@ deleteList :: Ord key => [key] -> Map key elt -> Map key elt
deleteList ks m = foldl (flip Map.delete) m ks
foldRight :: (elt -> a -> a) -> a -> Map key elt -> a
-foldRight = Map.fold
+foldRight = Map.foldr
foldRightWithKey :: (key -> elt -> a -> a) -> a -> Map key elt -> a
foldRightWithKey = Map.foldrWithKey
diff --git a/compiler/utils/UniqDFM.hs b/compiler/utils/UniqDFM.hs
index bbf6bb0..10e8aa9 100644
--- a/compiler/utils/UniqDFM.hs
+++ b/compiler/utils/UniqDFM.hs
@@ -360,10 +360,10 @@ mapUDFM :: (elt1 -> elt2) -> UniqDFM elt1 -> UniqDFM elt2
mapUDFM f (UDFM m i) = UDFM (M.map (fmap f) m) i
anyUDFM :: (elt -> Bool) -> UniqDFM elt -> Bool
-anyUDFM p (UDFM m _i) = M.fold ((||) . p . taggedFst) False m
+anyUDFM p (UDFM m _i) = M.foldr ((||) . p . taggedFst) False m
allUDFM :: (elt -> Bool) -> UniqDFM elt -> Bool
-allUDFM p (UDFM m _i) = M.fold ((&&) . p . taggedFst) True m
+allUDFM p (UDFM m _i) = M.foldr ((&&) . p . taggedFst) True m
instance Monoid (UniqDFM a) where
mempty = emptyUDFM
diff --git a/compiler/utils/UniqFM.hs b/compiler/utils/UniqFM.hs
index be5da83..38d9434 100644
--- a/compiler/utils/UniqFM.hs
+++ b/compiler/utils/UniqFM.hs
@@ -237,7 +237,7 @@ disjointUFM :: UniqFM elt1 -> UniqFM elt2 -> Bool
disjointUFM (UFM x) (UFM y) = M.null (M.intersection x y)
foldUFM :: (elt -> a -> a) -> a -> UniqFM elt -> a
-foldUFM k z (UFM m) = M.fold k z m
+foldUFM k z (UFM m) = M.foldr k z m
mapUFM :: (elt1 -> elt2) -> UniqFM elt1 -> UniqFM elt2
mapUFM f (UFM m) = UFM (M.map f m)
@@ -285,10 +285,10 @@ ufmToSet_Directly :: UniqFM elt -> S.IntSet
ufmToSet_Directly (UFM m) = M.keysSet m
anyUFM :: (elt -> Bool) -> UniqFM elt -> Bool
-anyUFM p (UFM m) = M.fold ((||) . p) False m
+anyUFM p (UFM m) = M.foldr ((||) . p) False m
allUFM :: (elt -> Bool) -> UniqFM elt -> Bool
-allUFM p (UFM m) = M.fold ((&&) . p) True m
+allUFM p (UFM m) = M.foldr ((&&) . p) True m
seqEltsUFM :: ([elt] -> ()) -> UniqFM elt -> ()
seqEltsUFM seqList = seqList . nonDetEltsUFM
@@ -312,13 +312,13 @@ nonDetKeysUFM (UFM m) = map getUnique $ M.keys m
-- If you use this please provide a justification why it doesn't introduce
-- nondeterminism.
nonDetFoldUFM :: (elt -> a -> a) -> a -> UniqFM elt -> a
-nonDetFoldUFM k z (UFM m) = M.fold k z m
+nonDetFoldUFM k z (UFM m) = M.foldr k z m
-- See Note [Deterministic UniqFM] to learn about nondeterminism.
-- If you use this please provide a justification why it doesn't introduce
-- nondeterminism.
nonDetFoldUFM_Directly:: (Unique -> elt -> a -> a) -> a -> UniqFM elt -> a
-nonDetFoldUFM_Directly k z (UFM m) = M.foldWithKey (k . getUnique) z m
+nonDetFoldUFM_Directly k z (UFM m) = M.foldrWithKey (k . getUnique) z m
-- See Note [Deterministic UniqFM] to learn about nondeterminism.
-- If you use this please provide a justification why it doesn't introduce
More information about the ghc-commits
mailing list