On Tue, Feb 17, 2004 at 04:57:34PM -0500, Andrew Pimlott wrote:
What about a more prosaic implementation:
notFollowedBy' :: Show a => GenParser tok st a -> GenParser tok st () notFollowedBy' p = do res <- do a <- try p; return $ Just a <|> return Nothing case res of Just a -> unexpected (show a) Nothing -> return ()
After some pondering and fiddling, a version I like: notFollowedBy' :: Show a => GenParser tok st a -> GenParser tok st () notFollowedBy' p = join $ do a <- try p; return (unexpected (show a)) <|> return (return ()) Andrew