@@ -275,6 +275,7 @@ import Streamly.Internal.Data.Fold.Type
275275-- >>> import qualified Streamly.Data.Fold as Fold
276276-- >>> import qualified Streamly.Internal.Data.Fold as Fold
277277-- >>> import qualified Streamly.Internal.Data.Parser as Parser
278+-- >>> import Data.IORef (newIORef, readIORef, writeIORef)
278279
279280------------------------------------------------------------------------------
280281-- hoist
@@ -1128,23 +1129,25 @@ distribute = Prelude.foldr (teeWith (:)) (fromPure [])
11281129--
11291130-- Send input to the two folds in a proportion of 2:1:
11301131--
1131−-- @
1132−-- import Data.IORef (newIORef, readIORef, writeIORef)
1132+-- >>> :{
11331133-- proportionately m n = do
11341134-- ref <- newIORef $ cycle $ concat [replicate m Left, replicate n Right]
1135−-- return $ \\a -> do
1135+-- return $ \a -> do
11361136-- r <- readIORef ref
11371137-- writeIORef ref $ tail r
1138−-- return $ head r a
1138+-- return $ Prelude.head r a
1139+-- :}
11391140--
1141+-- >>> :{
11401142-- main = do
11411143-- 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)
11431145-- print r
1144−-- @
1145−-- @
1146+-- :}
1147+--
1148+-- >>> main
11461149-- (67,33)
1147−-- @
1150+--
11481151--
11491152-- This is the consumer side dual of the producer side 'mergeBy' operation.
11501153--