on master help sign in
Update doc of the demux combinator
98a920eHarendra Kumar
core/src/Streamly/Internal/Data/Fold/Container.hs+8
@@ -326,6 +326,14 @@ demuxGeneric getKey getFold = fmap extract $ foldlM' step initial
326-- This can be used to scan a stream and collect the results from the scan
326-- This can be used to scan a stream and collect the results from the scan
327-- output.
327-- output.
328--
328--
329+-- Since the fold generator function is monadic we can add folds dynamically.
330+-- For example, we can maintain a Map of keys to folds in an IORef and lookup
331+-- the fold from that corresponding to a key. This Map can be changed
332+-- dynamically, folds for new keys can be added or folds for old keys can be
333+-- deleted or modified.
334+--
335+-- Compare with 'classify', the fold in 'classify' is a static fold.
336+--
329-- /Pre-release/
337-- /Pre-release/
330--
338--
331{-# INLINE demux #-}
339{-# INLINE demux #-}