summaryrefslogtreecommitdiff
blob: 65262ed90ebc697c6d4a53fdc63f0c3cb629be10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
	<herd>haskell</herd>
	<maintainer>
		<email>haskell@gentoo.org</email>
	</maintainer>
	<longdescription>
		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.
		
		&gt; (-# LANGUAGE OverloadedStrings #-)
		&gt;
		&gt; import Control.Applicative
		&gt; import Data.Attoparsec
		&gt; import Data.Attoparsec.Enumerator
		&gt; import Data.Enumerator
		&gt; import Data.Enumerator.Binary (enumHandle)
		&gt; import Data.Enumerator.List
		&gt; import System.IO
		&gt;
		&gt; parser = string &quot;foo&quot; &lt;|&gt; string &quot;bar&quot;
		&gt;
		&gt; main = do
		&gt;     xy &lt;- run_ (enumHandle 1 stdin $$ do
		&gt;         x &lt;- iterParser parser
		&gt;         y &lt;- iterParser parser
		&gt;         return (x, y))
		&gt;     print xy
	</longdescription>
</pkgmetadata>