I'm a complete newbie at Haskell. I'm trying to compile this Haskell file I've downloaded but it's giving me some errors.
No instance for (Text.Parsec.Prim.Stream s m Char)
arising from a use of 'letter' at Parse.lhs:649:26-31
Possible fix:
add an instance declaration for (Text.Parsec.Prim.Stream s m Char)
I开发者_如何学JAVAn the first argument of '(<|>)', namely 'letter'
In the expression: letter <|> oneOf "_"
In the definition of 'firstAllowed':
firstAllowed = letter <|> oneOf "_"
Not sure if this is enough, but here's the section of the code with the error:
parseIdent = do { str <- indent
; return (makeIdent str)
} <?> "identifier"
where firstAllowed = oneOf "_" <|> letter
In the part you quoted the local firstAllowed
function doesn't seem to be used anywhere. What happens if you remove the where
line?
Alternatively you could try to add this type signature to firstAllowed
:
where
firstAllowed :: Stream s m Char => ParsecT s u m Char
firstAllowed = ...
精彩评论