facebookincubator / retrie

Retrie is a powerful, easy-to-use codemodding tool for Haskell.
MIT License
502 stars 30 forks source link

Error message when working on GHC sources is unhelpful #41

Closed nrnrnr closed 2 years ago

nrnrnr commented 2 years ago

I'm trying to use retrie to refactor the GHC sources. Operating in the compiler subdirectory of the GHC gitlab root, I ran an ad-hoc rule with this result:

retrie --adhoc "forall x . not (backendNeedn'tLink x) == backendNeedsLink x"

parseAdhocs:1:80: error: parse error on input ‘#-}’
retrie: user error (parse failed)

From this error message, I can't tell if there's a problem with my rule, a problem with the GHC sources, or a problem with retrie. For starters, it would be useful to know the source location at which the offending #-} was observed.

pepeiborra commented 2 years ago

Thanks for the issue report.

I think the problem here is in the adhoc rule - the double equal == seems to be confusing the parser. This works better:

retrie --adhoc "forall x . not (backendNeedn'tLink x) = backendNeedsLink x"
nrnrnr commented 2 years ago

Ah! Thank you.

It still doesn't work very well because of the ' character in the function's name. I am going to try to submit a pull request to fix that.