[email protected]
[Top] [All Lists]

Re: [Haskell-cafe] Continuable and serializable parsers.

Subject: Re: [Haskell-cafe] Continuable and serializable parsers.
From: "Valery V. Vorotyntsev"
Date: Fri, 25 Dec 2009 22:51:47 +0200
Serguey Zefirov <[email protected]> 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
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>