[Haskell-cafe] Continuable and serializable parsers.

Serguey Zefirov sergueyz at gmail.com
Fri Dec 25 11:56:45 EST 2009

A pair of problems:
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.

2) How to write parser like one above that could be saved into database?

data ParserCont input result = ...
    deriving (Show, Read)
data ParseStepResult input result =
    Success (Maybe (ParserCont input result)) (Maybe result)
  | Failure

I could imagine that it is possible using parser generator like Happy.

Is it possible to get right using parsing combinators library?

More information about the Haskell-Cafe mailing list