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.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to