我正在尝试用我的语言支持String变量,并找到了我需要的解析器:
strP :: Parser String
strP = between (char '"') (char '"') (many1 $ noneOf "\"")
我可以在GHCi中使用它,但当我将它添加到我的代码中时:
stri = Val <$> VString <$> (between (char '"') (char '"') (many1 $ noneOf "\""))
它抱怨
No instance for (Text.Parsec.Prim.Stream s0 m0 Char)
arising from a use of `char'
The type variables `s0', `m0' are ambiguous
Possible fix: add a type signature that fixes these type variable(s)
但说实话,我不知道应该是什么类型:/