[Haskell-cafe] Continuable and serializable parsers.
Valery V. Vorotyntsev
valery.vv at gmail.com
Fri Dec 25 15:51:47 EST 2009
Serguey Zefirov <sergueyz at gmail.com> wrote:
>
> 1) How to write a parser that could be restarted? Like, it will be
> represented by a function that returns something along the lines
>
> data ParseStepResult input result =
> Success (Maybe (input -> ParseStepResult input result)) (Maybe result)
> | Failure
>
> (ie, parsers using stream combinators like Fudgets have that property)
> ie, either a continuation of parsing process and result or failure flag.
I think you're looking for `iteratees'.
| newtype IterateeG c el m a
| = IterateeG {runIter :: StreamG c el -> m (IterGV c el m a)}
|
| data IterGV c el m a
| = Done a (StreamG c el) | Cont (IterateeG c el m a) (Maybe ErrMsg)
|
| data StreamG c el = EOF (Maybe ErrMsg) | Chunk (c el)
See
http://okmij.org/ftp/Streams.html
http://hackage.haskell.org/package/iteratee
See also
http://www.haskell.org/haskellwiki/Enumerator_and_iteratee
http://therning.org/magnus/archives/735/comment-page-1#comment-188128
http://comonad.com/reader/2009/iteratees-parsec-and-monoid/
http://inmachina.net/~jwlato/haskell/iter-audio/
--
vvv
More information about the Haskell-Cafe
mailing list