我正在尝试使用 Parsec 在 Haskell 中编写一个简单的解析器,但我的输入“Hello World”从未被正确解析。
我的代码如下所示:
parser = p1 <|> p2 p1 = string "Hello" p2 = string "Hello World"
如果我运行它,我会收到错误unexpected whitespace
unexpected whitespace
parsing haskell parsec
haskell ×1
parsec ×1
parsing ×1