on master help sign in
Circumvent need to CPP import `foldl'` by using the Foldable Vector
d456ef0Adam Bergmark
Data/Aeson/Types/Internal.hs+3−5
@@ -69,6 +69,7 @@ import qualified Control.Monad.Fail as Fail
69import Data.ByteString.Builder (Builder, char7, toLazyByteString)
69import Data.ByteString.Builder (Builder, char7, toLazyByteString)
70import Data.Char (isLower, isUpper, toLower, isAlpha, isAlphaNum)
70import Data.Char (isLower, isUpper, toLower, isAlpha, isAlphaNum)
71import Data.Data (Data)
71import Data.Data (Data)
72+import Data.Foldable (foldl')
72import Data.HashMap.Strict (HashMap)
73import Data.HashMap.Strict (HashMap)
73import Data.Hashable (Hashable(..))
74import Data.Hashable (Hashable(..))
74import Data.Semigroup (Semigroup((<>)))
75import Data.Semigroup (Semigroup((<>)))
@@ -93,9 +94,6 @@ import Data.Traversable (Traversable(..))
93#if !MIN_VERSION_unordered_containers(0,2,6)
94#if !MIN_VERSION_unordered_containers(0,2,6)
94import Data.List (sort)
95import Data.List (sort)
95#endif
96#endif
96−#if MIN_VERSION_base(4,8,0) && !MIN_VERSION_unordered_containers(0,2,6)
97−import Data.Foldable (foldl')
98−#endif
99
97
100-- | Elements of a JSON path used to describe the location of an
98-- | Elements of a JSON path used to describe the location of an
101-- error.
99-- error.
@@ -387,7 +385,7 @@ newtype DotNetTime = DotNetTime {
387
385
388instance NFData Value where
386instance NFData Value where
389 rnf (Object o) = rnf o
387 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
391 rnf (String s) = rnf s
389 rnf (String s) = rnf s
392 rnf (Number n) = rnf n
390 rnf (Number n) = rnf n
393 rnf (Bool b) = rnf b
391 rnf (Bool b) = rnf b
@@ -406,7 +404,7 @@ hashValue s (Object o) = foldl' hashWithSalt
406 where
404 where
407 assocHashesSorted = sort [hash k `hashWithSalt` v | (k, v) <- H.toList o]
405 assocHashesSorted = sort [hash k `hashWithSalt` v | (k, v) <- H.toList o]
408#endif
406#endif
409−hashValue s (Array a) = V.foldl' hashWithSalt
407+hashValue s (Array a) = foldl' hashWithSalt
410 (s `hashWithSalt` (1::Int)) a
408 (s `hashWithSalt` (1::Int)) a
411hashValue s (String str) = s `hashWithSalt` (2::Int) `hashWithSalt` str
409hashValue s (String str) = s `hashWithSalt` (2::Int) `hashWithSalt` str
412hashValue s (Number n) = s `hashWithSalt` (3::Int) `hashWithSalt` n
410hashValue s (Number n) = s `hashWithSalt` (3::Int) `hashWithSalt` n