[Haskell-cafe] Re: Parsec: Parenthesized expressions and more!
Christian Maeder
Christian.Maeder at dfki.de
Tue Aug 14 05:00:31 EDT 2007
Vimal wrote:
> Hi
>
> I was trying out some parsing with parsec. I tried:
> Accepting proper parenthesized expressions, this was the
> code:
>
> parens :: Parser ()
> parens = do
> char '('
> parens
> char ')'
> parens
> <|> return ()
I would indent "<|> return ()" a bit less:
...
parens
<|> return ()
Use "parens >> eof" to test for full string consumption.
C.
More information about the Haskell-Cafe
mailing list