External Publication
Visit Post

Conduit to yield first lines from file without leaking space or file handles?

Haskell Community [Unofficial] May 11, 2026
Source

sjshuck:

The quick solution here is to sequester the file reading in its own ResourceT. See here.

Thanks for taking a look! That has the opposite problem for me: too early finalization. I have made a reply with an example.

sjshuck:

It should say the finalization will be run as soon as the conduit is exited, either normally or via exception.

Unfortunately I think not. In fact I don’t see any way to use ResourceT with ConduitT to achieve prompt finalization in the present of exceptions. That’s what I wrote about at Bluefin streams finalize promptly.

Discussion in the ATmosphere

Loading comments...