I'm playing with streaming again, I'm trying to do something simple. I just want to drop a few lines from the start of a file. This is what I got so far:
process :: MonadResource m => FilePath -> Stream (S.Of Lazy.ByteString) m () process path = B.readFile path & B.lines & S.mapped B.toLazy & S.drop 3
So at this point I just want to unlines again to go from
Stream (S.Of Lazy.ByteString) m () -- to Stream (ByteString m) m r -- So that I can apply unlines again to get ByteString m r
Any ideas on how I could go about this? I can't seem to find any functions that help me out here
Thanks!
B.lines returns "streaming lines" that don't need to be wholly in memory at any given time.
After B.lines, I would try to split the groups using Streaming.splitsAt, and then consume the first part of the bisected stream of lines using a combination of Streaming.mapsM_ and Data.ByteString.Streaming.effects.