External Publication
Visit Post

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

Haskell Community [Unofficial] May 2, 2026
Source

This is a place where continuation-based streaming libraries (like streamly or my own toy library jet-stream) are a bit more ergonomic than pull-based libraries like conduit or streaming. Because they control the continuation, it’s easier for them to manage allocation/deallocation of resources, even with functions like take.

I wrote a helper wrapper over streaming called streaming-bracketed to help with this same issue. From the package description:

Given a list [(Filepath,Int,Int)] of files and line ranges, create a stream of lines belonging to the concatenated ranges. Prompt release of file handles is required.

Discussion in the ATmosphere

Loading comments...