streamly
streamly copied to clipboard
Bracket/bracketIO for Folds
I would like to use:
writeChunks :: (MonadIO m, Storable a) => Handle -> Fold m (Array a) ()
but have it more modular, that is, move the handle opening and closing 'inside' the fold. In order to do that I need something like bracketIO, but for Folds. It doesn't seem to be currently available in Streamly. Is there a way to bypass this easily, or do I have to write my own bracketIO?
Take a look at this version of writeChunks . It does something similar to what you want.
What the above mentioned writeChunks is doing can be converted into a general Fold bracket combinator I guess.
Thank you @harendra-kumar.
Let's keep this open until it is implemented.