
On Thu, 1 Jan 2004 23:19:26 +0000 (GMT)
James Ealing
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, parseThreeVars = 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)