我正在寻找satisfy
像 Parsec 那样的功能。就像是:
--The parser satisfy f succeeds for any character for which the supplied
--function f returns True.
--Returns the character that is actually parsed.
satisfy :: (Char -> Bool) -> Parser Char
我发现的唯一东西是pSatisfy,它需要一个Insertion
as 参数。我不明白为什么这是必要的......我只是希望解析器在谓词不满足的情况下失败!
我怎样才能做到这一点?