I'm trying to do some parsing in Haskell using Parsec. I've got a number of parsers in my code, but am getting an error on one of them:
expression2 =
do (operator lexer "|"
a <- alternate
as <- expression2
return $ a:as
) <|> return []
The error is parse error on input '<-
, on the a <- alternate
line.
Can anyone explain why I'm getting this error, and how to fix it?
Thanks in advance.
Did you put the parens in the wrong place?
expression2 =
(do operator lexer "|"
a <- alternate
as <- expression2
return $ a:as) <|> return []