line-indexed-cursor-0.1.0.0: Line-indexed file reader.
Maintaineri@ak3n.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.IO.LineIndexedCursor

Description

Line-indexed file reader.

Lazily builds the index with the line numbers while reading the file making it possible to rewind to them quickly later.

The indices are stored using a list, with a fixed length capacity, and Array. Each new element is added to the list and when the capacity is reached, the list items get flushed to the array for faster access. The list's capacity can be configured using mkLineIndexedCursorWithCapacity.

Synopsis

Documentation

data LineIndexedCursor #

ADT with methods, hiding the internal state.

getCurrentLine, getCurrentLineUnsafe, doFullScan, and goToLine, all throw IOError.

Constructors

LineIndexedCursor 

Fields

mkLineIndexedCursor :: Handle -> IO LineIndexedCursor #

Builds LineIndexedCursor. Resets the file handle's ofsset to the beginning.

Use hSetNewlineMode if you want to configure NewlineMode.

mkLineIndexedCursorWithCapacity :: Handle -> Integer -> IO LineIndexedCursor #

Same as mkLineIndexedCursor but allows to configure the list's capacity.