on master help sign in
Relax minimum bounds on containers.

- We should try to match any of the core libraries version bounds with the min and max versions of ghc we support. This would allow the users to use the library together with another one that uses the ghc api with ease, preventing any possible version conflicts.

commitb05f7b43b45348ed68ccdd431124f0ffd56dacf7 authorPranay Sashank <pranaysashank@gmail.com> dateMon 6 Jan 2020, 13:06 (7 years ago) parent04a3b1e
2 files changed+22−6
src/Streamly/Internal/Data/Fold.hs+11 streamly.cabal+11−6
src/Streamly/Internal/Data/Fold.hs+11
@@ -1005,6 +1005,8 @@ demuxWith f kv = Fold step initial extract
10051005 where
10061006
10071007 initial = return kv
1008+-- alterF is available only since containers version 0.5.8.2
1009+#if MIN_VERSION_containers(0,5,8)
10081010 step mp a = case f a of
10091011 (k, a') -> Map.alterF twiddle k mp
10101012 -- XXX should we raise an exception in Nothing case?
@@ -1017,6 +1019,15 @@ demuxWith f kv = Fold step initial extract
10171019 twiddle (Just (Fold step' acc extract')) = do
10181020 !r <- acc >>= \x -> step' x a'
10191021 pure . Just $ Fold step' (return r) extract'
1022+#else
1023+ step mp a =
1024+ let (k, a') = f a
1025+ in case Map.lookup k mp of
1026+ Nothing -> return mp
1027+ Just (Fold step' acc extract') -> do
1028+ !r <- acc >>= \x -> step' x a'
1029+ return $ Map.insert k (Fold step' (return r) extract') mp
1030+#endif
10201031 extract = Prelude.mapM (\(Fold _ acc e) -> acc >>= e)
10211032
10221033-- | Fold a stream of key value pairs using a map of specific folds for each
streamly.cabal+11−6
@@ -356,12 +356,18 @@ library
356356 , Streamly.Internal.Network.Socket
357357 , Streamly.Internal.Network.Inet.TCP
358358
359− build-depends: base >= 4.8 && < 5
360− , ghc-prim >= 0.2 && < 0.6
359+ build-depends:
360+ -- Core libraries shipped with ghc, the min and max
361+ -- constraints of these libraries should match with
362+ -- the GHC versions we support
363+ base >= 4.8 && < 5
364+ , containers >= 0.5 && < 0.7
361365 , deepseq >= 1.4.1 && < 1.5
362− , containers >= 0.5.8.2 && < 0.7
363− , heaps >= 0.3 && < 0.4
364366 , directory >= 1.3 && < 1.4
367+ , ghc-prim >= 0.2 && < 0.6
368+ , transformers >= 0.4 && < 0.6
369+
370+ , heaps >= 0.3 && < 0.4
365371 , primitive >= 0.6.4.0 && < 0.8
366372
367373 -- concurrency
@@ -372,7 +378,6 @@ library
372378 , exceptions >= 0.8 && < 0.11
373379 , monad-control >= 1.0 && < 2
374380 , mtl >= 2.2 && < 3
375− , transformers >= 0.4 && < 0.6
376381 , transformers-base >= 0.4 && < 0.5
377382
378383 if !impl(ghcjs)
@@ -401,7 +406,7 @@ test-suite test
401406 streamly
402407 , base >= 4.8 && < 5
403408 , hspec >= 2.0 && < 3
404− , containers >= 0.5.8.2 && < 0.7
409+ , containers >= 0.5 && < 0.7
405410 , transformers >= 0.4 && < 0.6
406411 , mtl >= 2.2 && < 3
407412 , exceptions >= 0.8 && < 0.11