@hackage attoparsec-enumerator0.3.4
Pass input from an enumerator to an Attoparsec parser.
Categories
License
MIT
Maintainer
John Millikin <jmillikin@gmail.com>
Links
Versions
Deprecated
Dependencies (5)
- attoparsec >=0.10 && <0.14
- base >=4.0 && <5.0
- bytestring >=0.9
- enumerator >=0.4 && <0.5
- text Show all…
Dependents (27)
@hackage/ismtp, @hackage/BiobaseInfernal, @hackage/network-pgi, @hackage/snap-server, @hackage/leksah-server, @hackage/snap-core, Show all…
This library allows an Attoparsec parser to receive input incrementally from an enumerator. This could be used for parsing large files, or implementing binary network protocols.
(-# LANGUAGE OverloadedStrings #-)
import Control.Applicative
import Data.Attoparsec
import Data.Attoparsec.Enumerator
import Data.Enumerator
import Data.Enumerator.Binary (enumHandle)
import Data.Enumerator.List
import System.IO
parser = string "foo" <|> string "bar"
main = do
xy <- run_ (enumHandle 1 stdin $$ do
x <- iterParser parser
y <- iterParser parser
return (x, y))
print xy