| Maintainer | [email protected] |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
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.
Synopsis
- data LineIndexedCursor = LineIndexedCursor {
- getCurrentLine :: IO (Maybe ByteString)
- getCurrentLineUnsafe :: IO ByteString
- getCurrentLineNumber :: IO Integer
- doFullScan :: IO ()
- goToLine :: Integer -> IO Integer
- getHandle :: Handle
- getCursorState :: IO [Integer]
- mkLineIndexedCursor :: Handle -> IO LineIndexedCursor
- mkLineIndexedCursorWithCapacity :: Handle -> Integer -> IO LineIndexedCursor
Documentation
data LineIndexedCursor Source #
ADT with methods, hiding the internal state.
getCurrentLine, getCurrentLineUnsafe,
doFullScan, and goToLine, all throw IOError.
Constructors
| LineIndexedCursor | |
Fields
| |
mkLineIndexedCursor :: Handle -> IO LineIndexedCursor Source #
Builds LineIndexedCursor. Resets the file handle's ofsset to the beginning.
Use hSetNewlineMode if you want to configure NewlineMode.
mkLineIndexedCursorWithCapacity :: Handle -> Integer -> IO LineIndexedCursor Source #
Same as mkLineIndexedCursor but allows to configure the list's capacity.