문제

나는 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
도움이 되었습니까?

해결책

부분에서 당신은 현지인을 인용했습니다 firstAllowed 기능은 어디에서나 사용되지 않는 것 같습니다. 당신이 제거하면 어떻게됩니다 where 선?

또는이 유형의 서명을 추가하려고 시도 할 수 있습니다. firstAllowed:

 where
    firstAllowed :: Stream s m Char => ParsecT s u m Char
    firstAllowed = ...
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top