From 3e1b4b3cbb7dd0cd7bf6b0561df210a8972fad41 Mon Sep 17 00:00:00 2001 From: Bodigrim Date: Sat, 20 May 2023 13:02:53 +0100 Subject: [PATCH] Future-proof against potential Prelude.foldl' --- Cabal-syntax/src/Distribution/Compat/Prelude.hs | 6 +++--- Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cabal-syntax/src/Distribution/Compat/Prelude.hs b/Cabal-syntax/src/Distribution/Compat/Prelude.hs index 8c79d27d9a7..3a8c58f84f2 100644 --- a/Cabal-syntax/src/Distribution/Compat/Prelude.hs +++ b/Cabal-syntax/src/Distribution/Compat/Prelude.hs @@ -130,10 +130,9 @@ module Distribution.Compat.Prelude ( -- We also could hide few partial function import Prelude as BasePrelude hiding - ( mapM, mapM_, sequence, null, length, foldr, any, all, head, tail, last, init + ( mapM, mapM_, sequence, any, all, head, tail, last, init -- partial functions , read - , foldr1, foldl1 #if MINVER_base_411 -- As of base 4.11.0.0 Prelude exports part of Semigroup(..). -- Hide this so we instead rely on Distribution.Compat.Semigroup. @@ -142,8 +141,9 @@ import Prelude as BasePrelude hiding , Word -- We hide them, as we import only some members , Traversable, traverse, sequenceA - , Foldable, foldMap + , Foldable(..) ) +import Data.Foldable as BasePrelude (foldl, elem, sum, product, maximum, minimum) -- AMP import Data.Foldable diff --git a/Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs b/Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs index 44efa858a01..c2180b630b7 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs @@ -5,8 +5,9 @@ #endif module UnitTests.Distribution.Utils.CharSet where +import Prelude hiding (Foldable(..)) import Data.Char (isAlpha, isAlphaNum) -import Data.List (foldl') +import Data.Foldable (foldl') import Test.Tasty (TestTree, testGroup) import Test.Tasty.HUnit (testCase, (@?=))