followedBy parser in Parsec

Hi, Is there a way in Parsec to check what the next token is, and if it is what you're hoping for, leave it there. This is an example of something which doesn't work at all: testpar = try $ do ae <- array_element option [] $ try $ satisfy (\c -> c /= '(') >> unexpected "" return ae I'm finding this totally confusing by now %0 Can I invert "notFollowedBy" somehow, or maybe there's a "peek" function I don't know about? Help! Thanks, Paul

Paul Keir wrote:
Is there a way in Parsec to check what the next token is, and if it is what you're hoping for, leave it there.
Maybe you're looking for 'lookAhead'?
[...]
//Stephan -- Früher hieß es ja: Ich denke, also bin ich. Heute weiß man: Es geht auch so. - Dieter Nuhr
participants (2)
-
Paul Keir
-
Stephan Friedrichs