[Haskell-cafe] why 'try' not work in parsec

Ryan Ingram ryani.spam at gmail.com
Sun Nov 23 04:47:29 EST 2008


On Sat, Nov 22, 2008 at 9:46 AM, Changying Li <lchangying at gmail.com> wrote:
> Hi.
> I read 'write yourself a scheme in 48 hours' and try to modify its code.
> now part of code is :
>
> parseList :: Parser LispVal
> parseList = liftM List $ sepEndBy parseExpr spaces

>            <|> do char '('
>                   skipMany space
>                   x <- (try parseList) <|> parseDottedList
>                   char ')'
>                   return x

parseList is succeeding and returning (1); then "char ')'" is failing
(because the next character in the input is the '.'

  -- ryan


More information about the Haskell-Cafe mailing list