使用haskell中的其中一个,编译中的错误
我在Haskell是个十足的新手。 我正在尝试编译我下载的这个Haskell文件,但它给了我一些错误使用haskell中的其中一个,编译中的错误,haskell,ghc,parsec,Haskell,Ghc,Parsec,我在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 fi
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 "_"
没有(Text.Parsec.Prim.Stream s m Char)的实例
源于在语法分析中使用“字母”。lhs:649:26-31
可能的解决方案:
为(Text.Parsec.Prim.Stream s m Char)添加实例声明
在“()”的第一个参数中,即“字母”
在表达式中:字母“_”中的一个
在“firstAllowed”的定义中:
firstAllowed=字母“\u1”中的一个
不确定这是否足够,但下面是代码中出现错误的部分:
parseIdent = do { str <- indent
; return (makeIdent str)
} <?> "identifier"
where firstAllowed = oneOf "_" <|> letter
parseIdent=do{str在您引用的部分中,本地firstAllowed
函数似乎没有在任何地方使用。如果删除where
行,会发生什么情况
或者,您可以尝试将此类型签名添加到firstAllowed
:
where
firstAllowed :: Stream s m Char => ParsecT s u m Char
firstAllowed = ...
给自己写一个计划?