Hi, The pipes-group and streaming libraries both give you functions like "group", "groupBy" and "chunksOf" that let you segment a stream while preserving streaming. I was thinking of implementing these two additional functions:
delimit :: (x -> a -> (x,NonEmpty [b])) -> x -> (x -> NonEmpty [b]) -> Stream (Of a) m r -> Stream (Stream (Of b) m) m r delimitM :: (x -> a -> Stream (Of b) m (Stream (Stream (Of b) m) m x)) -> m x -> (x -> Stream (Of b) m (Stream (Stream (Of b) m) m ())) -> Stream (Of a) m r -> Stream (Stream (Of b) m) m r For "delimit", the idea is that every step produces a NonEmpty list of lists along with the new internal state. The list at the head would consist of elements belonging to the "current open group". If there are more lists afterwards, they represent new groups which have been detected in the stream. For streams comprising one single continuous group, the NonEmptys would *always* contain just one list. "delimitM" is the monadic version, although here the types start getting quite scary. What do you think? Would "delimit" make sense, or at this level of complexity it would be better to build the splitting function by single-stepping the source stream? (Extra semi-related question: could the FreeT trick used in pipes-group also be applied to Sources from the conduit library?) -- You received this message because you are subscribed to the Google Groups "Haskell Pipes" group. To unsubscribe from this group and stop receiving emails from it, send an email to haskell-pipes+unsubscr...@googlegroups.com. To post to this group, send email to haskell-pipes@googlegroups.com.