on master help sign in
Try an even more robust way of handling containers.
commitf2b6bfc0c4c3c6b1c8014bd291282cbb519f1290 authorBryan O'Sullivan <bos@serpentine.com> dateWed 2 Nov 2011, 06:12 (15 years ago) parent5c4bf57
2 files changed+12−11
Data/Aeson/Types/Internal.hs+9−1 aeson.cabal+3−10
Data/Aeson/Types/Internal.hs+9−1
@@ -216,13 +216,21 @@ data Value = Object Object
216216 deriving (Eq, Show, Typeable, Data)
217217
218218instance NFData Value where
219− rnf (Object o) = rnf o
219+ rnf (Object o) = obj_rnf o
220220 rnf (Array a) = V.foldl' (\x y -> rnf y `seq` x) () a
221221 rnf (String s) = rnf s
222222 rnf (Number n) = case n of I i -> rnf i; D d -> rnf d
223223 rnf (Bool b) = rnf b
224224 rnf Null = ()
225225
226+obj_rnf :: (NFData k, NFData v) => Map k v -> ()
227+#if MIN_VERSION_containers(0,4,2)
228+obj_rnf = rnf
229+#else
230+obj_rnf M.Tip = ()
231+obj_rnf (M.Bin _ kx x l r) = rnf kx `seq` rnf x `seq` rnf l `seq` rnf r
232+#endif
233+
226234instance IsString Value where
227235 fromString = String . pack
228236 {-# INLINE fromString #-}
aeson.cabal+3−10
@@ -124,25 +124,18 @@ library
124124 blaze-builder >= 0.2.1.4,
125125 blaze-textual >= 0.2.0.2,
126126 bytestring,
127+ containers,
128+ deepseq,
127129 hashable >= 1.1.2.0,
128130 mtl,
129131 old-locale,
130132 syb,
131− text >= 0.11.0.2,
132133 template-haskell >= 2.4,
134+ text >= 0.11.0.2,
133135 time,
134136 unordered-containers >= 0.1.3.0,
135137 vector >= 0.7.1
136138
137− if impl(ghc < 7.2)
138− build-depends:
139− containers < 0.4.2,
140− deepseq < 1.2
141− else
142− build-depends:
143− containers >= 0.4.2,
144− deepseq >= 1.2
145−
146139 if flag(developer)
147140 ghc-options: -Werror
148141 ghc-prof-options: -auto-all