Closed haasn closed 7 years ago
The pipes-group
library solves this purpose: https://hackage.haskell.org/package/pipes-group/docs/Pipes-Group-Tutorial.html
However, I strongly recommend using the streaming
library which solves this use case better (and is better optimized for it)
Interesting, that one is new to me. It does looks promising.
One of the things in particular that I was going to try combining with pipes
is the pipes-concurrency
library, although after studying the code a bit I believe I can reimplement the functionality using TQueue
on top of streaming
without having to incur a pipes
dependency.
I'm trying to find a function that allows me to do something with the equivalent of this type signature:
I'm also struggling to try and define this myself. The naive approach that comes to mind is the following:
But this will fail when the number of values in the input is not a perfect multiple of
n
, for example:The last
[10]
group is omitted here because theawait
fails before it has a chance toyield
the partial list. How do I implement this function in a better way, and is it defined anywhere already?It seems like it would be useful for a number of things that can process values in batches rather than one-by-one.