Am Donnerstag 20 August 2009 13:44:15 schrieb Martijn van Steenbergen:
> Goedemiddag café,
>
> Consider the following function, using parsec-3.0.0:
> > la :: Parsec String () (Maybe Char)
> > la = lookAhead (optionMaybe anyChar)
>
> *Lookahead> parseTest (char 'a' <|> char 'b') "a"
> 'a'
> *Lookahe
Yeah, that's weird. I played around with la and it seems to only cause
problems when the parser passed into lookAhead succeeds, which seem to go
directly against it's stated purpose.
lookAhead isn't consuming, (hence the unexpected "b") but still prevents
<|> from doing it's thing.
Seems like a
Goedemiddag café,
Consider the following function, using parsec-3.0.0:
la :: Parsec String () (Maybe Char)
la = lookAhead (optionMaybe anyChar)
*Lookahead> parseTest (char 'a' <|> char 'b') "a"
'a'
*Lookahead> parseTest (char 'a' <|> char 'b') "b"
'b'
*Lookahead> parseTest (la *> char 'a' <|>