I plan to write a function along the lines of (In fact, I have already written a variation of this at least 5 times on different projects, which is why I want it on some library):
chunksOfE :: (IsSequence seq) -> Index seq -> Conduit seq m seq
Every sequence it yields (except the last) will have the given number of elements. We can also have chunksOfExactlyE which would not yield a final element if it is not big enough (it'd be a leftover).
If you think it could fit here, I'll do it as a PR here; otherwise I will add it to conduit-algorithms.
(Maybe there is a simple way to do this already in conduit-combinators, but I always end up writing it).
I plan to write a function along the lines of (In fact, I have already written a variation of this at least 5 times on different projects, which is why I want it on some library):
Every sequence it yields (except the last) will have the given number of elements. We can also have
chunksOfExactlyE
which would not yield a final element if it is not big enough (it'd be aleftover
).If you think it could fit here, I'll do it as a PR here; otherwise I will add it to conduit-algorithms.
(Maybe there is a simple way to do this already in
conduit-combinators
, but I always end up writing it).