[Haskell-cafe] followedBy parser in Parsec

Paul Keir pkeir at dcs.gla.ac.uk
Thu Nov 27 12:57:57 EST 2008


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!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081127/46301d0e/attachment.htm

More information about the Haskell-Cafe mailing list