2

我是 Haskell 的新手。我正在尝试编译我下载的这个 Haskell 文件,但它给了我一些错误。

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)
In the first argument of '(<|>)', namely 'letter'
In the expression: letter <|> oneOf "_"
In the definition of 'firstAllowed':
  firstAllowed = letter <|> oneOf "_"

不确定这是否足够,但这是有错误的代码部分:

parseIdent = do { str <- indent
                ; return (makeIdent str)
                } <?> "identifier"
  where firstAllowed = oneOf "_" <|> letter
4

1 回答 1

4

在您引用的部分中,本地firstAllowed函数似乎没有在任何地方使用。如果删除where线会发生什么?

或者,您可以尝试将此类型签名添加到firstAllowed

 where
    firstAllowed :: Stream s m Char => ParsecT s u m Char
    firstAllowed = ...
于 2010-01-13T00:56:01.820 回答