The following code compiles without issue:
import Text.ParserCombinators.Parsec (many, noneOf, GenParser)
notNewline :: GenParser Char st String
notNewline = many (noneOf "\n")
main = print "Hello"
But once I comment the type signature, like so:
import Text.ParserCombinators.Parsec (many, noneOf, GenParser)
--notNewline :: GenParser Char st String
notNewline = many (noneOf "\n")
main = print "Hello"
I get the following error:
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 "")
Why do I get an error message from omitting the type signature?