The first version of incremental-parser has been released on Hackage [1]. It&#39;s yet another parser combinator<br>library, providing the usual set of Applicative and Monad combinators. Apart from this, it has three twists that make it<br>
unique.<br><br>    First, the parser is incremental. That means it can be fed its input in chunks, and in proper circumstances it can<br>also provide the parsed output in chunks. For this to be possible the result type must be a Monoid. The complete parsing<br>
result is then a concatenation of the partial results.<br><br>    In order to make the incremental parsing easier, the combinator set is optimized for monoidal results. The usual<br>combinator many1, for example, assumes the result type is a monoid and concatenates its components instead of<br>
constructing a list.<br><br>In Parsec:<br>&gt; many1 :: Stream s m t =&gt; ParsecT s u m a -&gt; ParsecT s u m [a]<br><br>In incremental-parser:<br>&gt; many1 :: (Monoid s, Monoid r) =&gt; Parser s r -&gt; Parser s r<br><br>
<br>    The second weirdness is that the the parser is generic in its input stream type, but this type is parameterized in a<br>holistic way. There is no separate token type. Primitive parsers that need to peek into the input require its type to be<br>
an instance of a monoid subclass.<br><br>In Parsec:<br>&gt; string :: Stream s m Char =&gt; String -&gt; ParsecT s u m String<br>&gt; char :: Stream s m Char =&gt; Char -&gt; ParsecT s u m Char<br>&gt; anyToken :: (Stream s m t, Show t) =&gt; ParsecT s u m t<br>
<br>In Attoparsec:<br>&gt; string :: ByteString -&gt; Parser ByteString<br>&gt; word8 :: Word8 -&gt; Parser Word8<br>&gt; anyWord8 :: Parser Word8<br><br>In incremental-parser:<br>&gt; string :: (LeftCancellativeMonoid s, MonoidNull s) =&gt; s -&gt; Parser s s<br>
&gt; token :: (Eq s, FactorialMonoid s) =&gt; s -&gt; Parser s s<br>&gt; anyToken :: FactorialMonoid s =&gt; Parser s s<br><br>    The monoid subclasses referenced above provide methods for analyzing and subdividing the input stream. The classes<br>
are not particularly demanding, and any reasonable input stream should be able to accommodate them easily. The library<br>comes with instances for lists, ByteString, and Text.<br><br>&gt; class Monoid m =&gt; MonoidNull m where<br>
&gt;    mnull :: m -&gt; Bool<br><br>&gt; class Monoid m =&gt; LeftCancellativeMonoid m where<br>&gt;    mstripPrefix :: m -&gt; m -&gt; Maybe m<br><br>&gt; class Monoid m =&gt; FactorialMonoid m where<br>&gt;    factors :: m -&gt; [m]<br>
&gt;    primePrefix :: m -&gt; m<br>&gt;    ...<br><br><br>    Finally, the library being implemented on the basis of Brzozowski derivatives, it can provide both the symmetric and<br>the left-biased choice, &lt;|&gt; and &lt;&lt;|&gt;. This is the same design choice made by Text.ParserCombinators.ReadP and<br>
uu-parsinglib. Parsec and its progeny on the other hand provide only the faster left-biased choice, at some cost to the<br>expressiveness of the combinator language.<br><br>[1] <a href="http://hackage.haskell.org/package/incremental-parser-0.1">http://hackage.haskell.org/package/incremental-parser-0.1</a><br>
<br>