Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
IO scanners for use with the Streamline monad transformer.
- type IOScanner a = a -> Word8 -> IOScannerState a
- data IOScannerState a
- textScanner :: [Word8] -> IOScanner [[Word8]]
- anyScanner :: Default a => [IOScanner a] -> IOScanner [a]
Documentation
type IOScanner a = a -> Word8 -> IOScannerState a Source
IOScanner type, as required by the scan functions of Streamline
data IOScannerState a Source
State of an IO scanner. Differently from a parser scanner, an IO scanner must deal with blocking behavior.
Finished | A scanner returns Finished when the current input is not part of the result, and the scanning must stop before this input. |
LastPass a | A scanner returns LastPass when the current input is the last one of the result, and the scanning must stop before after this input, without consuming more data. |
Running a | A scanner returns Running when the current input is part of the result, and the scanning must continue. |
textScanner :: [Word8] -> IOScanner [[Word8]] Source
Given a sequence of bytes, creates a scanner that will scan its input untill that sequence is found.
anyScanner :: Default a => [IOScanner a] -> IOScanner [a] Source
Creates a scanner that'll finish when any of the given scanners finish.