Parsing library

Derek Elkins ddarius at
Fri Jan 2 03:17:50 EST 2004

On Thu, 1 Jan 2004 23:19:26 +0000 (GMT)
James Ealing <jamesealing2000 at> wrote:

> I'm trying to make use of the combinatorial parsing
> library to process strings. However, I can't figure
> out the correct syntax for the (|||) (^^^) (>>>) (<^^)
> and (^^>) functions. Can anyone see how to do it? 

The utility functions, e.g. many, give examples.  Nevertheless, an
untested example would be,
    = parseVar ^^^ white ^^> parseVar ^^^ white ^^> parseVar >>>
      \(a,(b,c)) -> (a,b,c)

However, if possible, I'd recommend a different parser library, e.g.
Parsec.  Failing that, I would make the parser an instance of Monad
(which Parsec parsers are), so the above would be,
parseThreeVars = do
    a <- parseVar; white
    b <- parseVar; white
    c <- parseVar
    return (a,b,c)

More information about the Haskell-Cafe mailing list