uniform-io-1.2.0.0: Uniform IO over files, network, anything.

Safe HaskellSafe
LanguageHaskell2010

System.IO.Uniform.Streamline.Scanner

Description

IO scanners for use with the Streamline monad transformer.

Synopsis

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.

Constructors

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.