@@ -275,6 +275,7 @@ import Streamly.Internal.Data.Fold.Type
275-- >>> import qualified Streamly.Data.Fold as Fold
275-- >>> import qualified Streamly.Data.Fold as Fold
276-- >>> import qualified Streamly.Internal.Data.Fold as Fold
276-- >>> import qualified Streamly.Internal.Data.Fold as Fold
277-- >>> import qualified Streamly.Internal.Data.Parser as Parser
277-- >>> import qualified Streamly.Internal.Data.Parser as Parser
278+-- >>> import Data.IORef (newIORef, readIORef, writeIORef)
279------------------------------------------------------------------------------
280------------------------------------------------------------------------------
@@ -1128,23 +1129,25 @@ distribute = Prelude.foldr (teeWith (:)) (fromPure [])
1129-- Send input to the two folds in a proportion of 2:1:
1130-- Send input to the two folds in a proportion of 2:1:
1132−-- import Data.IORef (newIORef, readIORef, writeIORef)
1133-- proportionately m n = do
1133-- proportionately m n = do
1134-- ref <- newIORef $ cycle $ concat [replicate m Left, replicate n Right]
1134-- ref <- newIORef $ cycle $ concat [replicate m Left, replicate n Right]
1135−-- return $ \\a -> do
1135+-- return $ \a -> do
1136-- r <- readIORef ref
1136-- r <- readIORef ref
1137-- writeIORef ref $ tail r
1137-- writeIORef ref $ tail r
1138−-- return $ head r a
1138+-- return $ Prelude.head r a
1140-- main = do
1142-- main = do
1141-- f <- proportionately 2 1
1143-- f <- proportionately 2 1
1142−-- r <- S.fold (FL.partitionByM f FL.length FL.length) (S.enumerateFromTo (1 :: Int) 100)
1144+-- r <- Stream.fold (Fold.partitionByM f Fold.length Fold.length) (Stream.enumerateFromTo (1 :: Int) 100)
1143-- print r
1145-- print r
1146-- (67,33)
1149-- (67,33)
1149-- This is the consumer side dual of the producer side 'mergeBy' operation.
1152-- This is the consumer side dual of the producer side 'mergeBy' operation.