Question

Je suis un débutant complet à Haskell. Je suis en train de compiler ce fichier Haskell que je l'ai téléchargé mais il me donne des erreurs.

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 "_"

Je ne sais pas si cela suffit, mais voici la section du code avec l'erreur:

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

La solution

Dans la partie que vous avez cité la fonction firstAllowed locale ne semble pas être utilisé partout. Qu'advient-il si vous supprimez la ligne de where?

Sinon, vous pouvez essayer d'ajouter cette signature de type à firstAllowed:

 where
    firstAllowed :: Stream s m Char => ParsecT s u m Char
    firstAllowed = ...
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top