on master help sign in
Circumvent need to CPP import `foldl'` by using the Foldable Vector

instance. Foldable Vector was added in `vector-0.8`, luckily aeson doesn't build with earlier versions. Fixes #379 and #380.

commitd456ef0f7c2afabec43fcca1428cff559d6a6494 authorAdam Bergmark <adam@bergmark.nl> dateWed 23 Mar 2016, 22:09 (11 years ago) parentba6d46f
1 file changed+3−5
Data/Aeson/Types/Internal.hs+3−5
Data/Aeson/Types/Internal.hs+3−5
@@ -69,6 +69,7 @@ import qualified Control.Monad.Fail as Fail
6969import Data.ByteString.Builder (Builder, char7, toLazyByteString)
7070import Data.Char (isLower, isUpper, toLower, isAlpha, isAlphaNum)
7171import Data.Data (Data)
72+import Data.Foldable (foldl')
7273import Data.HashMap.Strict (HashMap)
7374import Data.Hashable (Hashable(..))
7475import Data.Semigroup (Semigroup((<>)))
@@ -93,9 +94,6 @@ import Data.Traversable (Traversable(..))
9394#if !MIN_VERSION_unordered_containers(0,2,6)
9495import Data.List (sort)
9596#endif
96−#if MIN_VERSION_base(4,8,0) && !MIN_VERSION_unordered_containers(0,2,6)
97−import Data.Foldable (foldl')
98−#endif
9997
10098-- | Elements of a JSON path used to describe the location of an
10199-- error.
@@ -387,7 +385,7 @@ newtype DotNetTime = DotNetTime {
387385
388386instance NFData Value where
389387 rnf (Object o) = rnf o
390− rnf (Array a) = V.foldl' (\x y -> rnf y `seq` x) () a
388+ rnf (Array a) = foldl' (\x y -> rnf y `seq` x) () a
391389 rnf (String s) = rnf s
392390 rnf (Number n) = rnf n
393391 rnf (Bool b) = rnf b
@@ -406,7 +404,7 @@ hashValue s (Object o) = foldl' hashWithSalt
406404 where
407405 assocHashesSorted = sort [hash k `hashWithSalt` v | (k, v) <- H.toList o]
408406#endif
409−hashValue s (Array a) = V.foldl' hashWithSalt
407+hashValue s (Array a) = foldl' hashWithSalt
410408 (s `hashWithSalt` (1::Int)) a
411409hashValue s (String str) = s `hashWithSalt` (2::Int) `hashWithSalt` str
412410hashValue s (Number n) = s `hashWithSalt` (3::Int) `hashWithSalt` n