[commit: ghc] master: Generalise (some of) Data.List to Foldables (re #9568) (05cf18f)

git at git.haskell.org git at git.haskell.org
Sat Sep 20 21:53:44 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/05cf18f883bf2d49b53a1d25cb57eff3333eb0c9/ghc

>---------------------------------------------------------------

commit 05cf18f883bf2d49b53a1d25cb57eff3333eb0c9
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date:   Sat Sep 20 23:50:06 2014 +0200

    Generalise (some of) Data.List to Foldables (re #9568)
    
    This replaces the entities in Data.List conflicting with Data.Foldable
    with re-exports of the generalised version from Data.Foldable.
    
    As of this commit, the following compiles w/o error
    
        module XPrelude (module X) where
    
        import Control.Monad as X
        import Data.Foldable as X
        import Data.List as X
        import Prelude as X
    
    Reviewed By: austin, dfeuer, ekmett
    
    Differential Revision: https://phabricator.haskell.org/D229


>---------------------------------------------------------------

05cf18f883bf2d49b53a1d25cb57eff3333eb0c9
 libraries/base/Data/List.hs                         |  7 +++++--
 libraries/base/changelog.md                         | 10 ++++++++++
 testsuite/tests/rename/should_fail/rnfail032.stderr |  4 ++--
 testsuite/tests/rename/should_fail/rnfail033.stderr |  4 ++--
 4 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/libraries/base/Data/List.hs b/libraries/base/Data/List.hs
index 44c86bb..5bc8121 100644
--- a/libraries/base/Data/List.hs
+++ b/libraries/base/Data/List.hs
@@ -207,5 +207,8 @@ module Data.List
 
    ) where
 
-import Data.Foldable ()
-import Data.OldList
+import Data.Foldable
+import Data.OldList hiding ( all, and, any, concat, concatMap, elem, find,
+                             foldl, foldl1, foldl', foldr, foldr1, maximum,
+                             maximumBy, minimum, minimumBy, notElem, or,
+                             product, sum )
diff --git a/libraries/base/changelog.md b/libraries/base/changelog.md
index d82d354..c57d5f0 100644
--- a/libraries/base/changelog.md
+++ b/libraries/base/changelog.md
@@ -35,6 +35,16 @@
   * Turn `toList`, `elem`, `sum`, `product`, `maximum`, and `minimum`
     into `Foldable` methods (#9621)
 
+  * Replace the `Data.List`-exported functions
+
+    ```
+    all, and, any, concat, concatMap, elem, find, product, sum
+    ```
+
+    by re-exports of their generalised `Data.Foldable` counterparts.
+    In other words, unqualified imports of `Data.List` and
+    `Data.Foldable` no longer lead to conflicting definitions. (#9586)
+
 ## 4.7.0.1  *Jul 2014*
 
   * Bundled with GHC 7.8.3
diff --git a/testsuite/tests/rename/should_fail/rnfail032.stderr b/testsuite/tests/rename/should_fail/rnfail032.stderr
index 8a2bf0c..2169fd5 100644
--- a/testsuite/tests/rename/should_fail/rnfail032.stderr
+++ b/testsuite/tests/rename/should_fail/rnfail032.stderr
@@ -3,5 +3,5 @@ rnfail032.hs:2:21:
     Not in scope: ‘Data.List.map’
     Perhaps you meant one of these:
       ‘Data.List.zip’ (imported from Data.List),
-      ‘Data.List.sum’ (imported from Data.List),
-      ‘Data.List.all’ (imported from Data.List)
+      ‘Data.List.all’ (imported from Data.List),
+      ‘Data.List.and’ (imported from Data.List)
diff --git a/testsuite/tests/rename/should_fail/rnfail033.stderr b/testsuite/tests/rename/should_fail/rnfail033.stderr
index 9e95a85..6b6849d 100644
--- a/testsuite/tests/rename/should_fail/rnfail033.stderr
+++ b/testsuite/tests/rename/should_fail/rnfail033.stderr
@@ -3,5 +3,5 @@ rnfail033.hs:2:21:
     Not in scope: ‘Data.List.map’
     Perhaps you meant one of these:
       ‘Data.List.zip’ (imported from Data.List),
-      ‘Data.List.sum’ (imported from Data.List),
-      ‘Data.List.all’ (imported from Data.List)
+      ‘Data.List.all’ (imported from Data.List),
+      ‘Data.List.and’ (imported from Data.List)



More information about the ghc-commits mailing list