解析 haskell 字符串时如何跳过空格

How can I skip spaces when parsing a haskell string

我在使用 Haskell ReadP 库的解析器中有以下定义:

expr = chainl1 comp (string "===" >> return fun6) 

如何跳过 === 运算符前的空格?我不知道如何将它包含在此语法中。

ReadPskipSpaces 正是那个用例;然后你的解析器变成

expr = chainl1 comp (skipSpaces >> string "===" >> return fun6)