on master help sign in
Relax minimum bounds on containers.
b05f7b4Pranay Sashank
src/Streamly/Internal/Data/Fold.hs+11
@@ -1005,6 +1005,8 @@ demuxWith f kv = Fold step initial extract
1005 where
1005 where
1006
1006
1007 initial = return kv
1007 initial = return kv
1008+-- alterF is available only since containers version 0.5.8.2
1009+#if MIN_VERSION_containers(0,5,8)
1008 step mp a = case f a of
1010 step mp a = case f a of
1009 (k, a') -> Map.alterF twiddle k mp
1011 (k, a') -> Map.alterF twiddle k mp
1010 -- XXX should we raise an exception in Nothing case?
1012 -- XXX should we raise an exception in Nothing case?
@@ -1017,6 +1019,15 @@ demuxWith f kv = Fold step initial extract
1017 twiddle (Just (Fold step' acc extract')) = do
1019 twiddle (Just (Fold step' acc extract')) = do
1018 !r <- acc >>= \x -> step' x a'
1020 !r <- acc >>= \x -> step' x a'
1019 pure . Just $ Fold step' (return r) extract'
1021 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
1020 extract = Prelude.mapM (\(Fold _ acc e) -> acc >>= e)
1031 extract = Prelude.mapM (\(Fold _ acc e) -> acc >>= e)
1021
1032
1022-- | Fold a stream of key value pairs using a map of specific folds for each
1033-- | Fold a stream of key value pairs using a map of specific folds for each
streamly.cabal+11−6
@@ -356,12 +356,18 @@ library
356 , Streamly.Internal.Network.Socket
356 , Streamly.Internal.Network.Socket
357 , Streamly.Internal.Network.Inet.TCP
357 , Streamly.Internal.Network.Inet.TCP
358
358
359− build-depends: base >= 4.8 && < 5
359+ build-depends:
360− , ghc-prim >= 0.2 && < 0.6
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
361 , deepseq >= 1.4.1 && < 1.5
365 , deepseq >= 1.4.1 && < 1.5
362− , containers >= 0.5.8.2 && < 0.7
363− , heaps >= 0.3 && < 0.4
364 , directory >= 1.3 && < 1.4
366 , 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
365 , primitive >= 0.6.4.0 && < 0.8
371 , primitive >= 0.6.4.0 && < 0.8
366
372
367 -- concurrency
373 -- concurrency
@@ -372,7 +378,6 @@ library
372 , exceptions >= 0.8 && < 0.11
378 , exceptions >= 0.8 && < 0.11
373 , monad-control >= 1.0 && < 2
379 , monad-control >= 1.0 && < 2
374 , mtl >= 2.2 && < 3
380 , mtl >= 2.2 && < 3
375− , transformers >= 0.4 && < 0.6
376 , transformers-base >= 0.4 && < 0.5
381 , transformers-base >= 0.4 && < 0.5
377
382
378 if !impl(ghcjs)
383 if !impl(ghcjs)
@@ -401,7 +406,7 @@ test-suite test
401 streamly
406 streamly
402 , base >= 4.8 && < 5
407 , base >= 4.8 && < 5
403 , hspec >= 2.0 && < 3
408 , hspec >= 2.0 && < 3
404− , containers >= 0.5.8.2 && < 0.7
409+ , containers >= 0.5 && < 0.7
405 , transformers >= 0.4 && < 0.6
410 , transformers >= 0.4 && < 0.6
406 , mtl >= 2.2 && < 3
411 , mtl >= 2.2 && < 3
407 , exceptions >= 0.8 && < 0.11
412 , exceptions >= 0.8 && < 0.11