以下代码编译没有问题:
import Text.ParserCombinators.Parsec (many, noneOf, GenParser)
notNewline :: GenParser Char st String
notNewline = many (noneOf "\n")
main = print "Hello"
但是一旦我评论了类型签名,就像这样:
import Text.ParserCombinators.Parsec (many, noneOf, GenParser)
--notNewline :: GenParser Char st String
notNewline = many (noneOf "\n")
main = print "Hello"
我收到以下错误:
No instance for (Text.Parsec.Prim.Stream s0 m0 Char)
arising from a use of `noneOf'
Possible fix:
add an instance declaration for
(Text.Parsec.Prim.Stream s0 m0 Char)
In the first argument of `many', namely `(noneOf "")'
In the expression: many (noneOf "")
In an equation for `notNewline': notNewline = many (noneOf "")
为什么我从省略类型签名时收到错误消息?