Parsec question

Mark Carroll mark at chaos.x-philes.com
Wed Dec 31 19:21:54 EST 2003


I tried posting this before but, from my point of view, it vanished. My
apologies if it's a duplicate.

In http://www.cs.uu.nl/~daan/download/parsec/parsec.html we read,

> testOr2 =   try (string "(a)")
>         <|> string "(b)"
>
> or an even better version:
>
> testOr3 =   do{ try (string "(a"); char ')'; return "(a)" }
>         <|> string "(b)"

Why is the latter better?

(BTW, I like Parsec. Thanks, Daan. (-:)

-- Mark


More information about the Haskell-Cafe mailing list