binary icon indicating copy to clipboard operation
binary copied to clipboard

I can't just get the answer and builder out of Put in a single call.

Open ekmett opened this issue 7 years ago • 2 comments
trafficstars

There is no way to get out Put a -> (a, Builder) in a single call.

This is also a wart in the design of cereal.

This seems to be a bit of a lacuna in the current design.

ekmett avatar Aug 05 '18 19:08 ekmett

So you want back the item you just wrote?

kolmodin avatar Oct 06 '18 13:10 kolmodin

PutM is a Monad. I have a legitimate usecase where I want to lift a PutM computation into a larger monad, which is juggling 3 such builders simultaneously, with some delicate interplay between the information being written to each, but to be able to do so I need to be able to "run" it without destroying all benefit of using it in the first place by round-tripping out to ByteString, so yes.

ekmett avatar Oct 07 '18 14:10 ekmett