Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feasibility of using retrie to refactor for Data.List monomorphisation #26

Open
bgamari opened this issue Jun 20, 2021 · 5 comments
Open

Comments

@bgamari
Copy link

bgamari commented Jun 20, 2021

In GHC 9.2 Data.List is changing with the expectation that all imports be qualified (or, at very least, bearing an explicit import list). Specifically, we would need to change all occurrences of declarations defined in Data.List to a module prefixed name (e.g. L.map) and change all imports to qualified imports.

As this will be a somewhat invasive change, it would be great to be able to offer a retrie recipe in the GHC 9.2 migration guide. Is this feasible?

@xich
Copy link
Contributor

xich commented Jun 21, 2021

I think it depends on how automated you want this to be. If the end user is willing to do a little work themselves, then you could do something like:

for fn in map fold; do
  retrie --adhoc "$fn = L.$fn" --import "import qualified Data.List as L"
done

(it would be faster if we did all the rewrites at once by building something with runScript instead of iterating in bash)

But that will rewrite any instance of map, not just the one from Data.List. It will also leave around any existing imports, which will presumably need deleted.

If you want this it be fully automatic, we'd need to solve #10 first and probably build this into/with haskell-language-server (so we have a source of renamed identifiers) cc @pepeiborra. (And also add import deletion/modification, but that is easy.)

What's your timeline? I think I have a handle on how to tackle #10, but am traveling the first couple weeks of July, so not sure how soon I could have something ready.

@pepeiborra
Copy link
Contributor

/cc @OliverMadine who was also looking at a closer integration of retrie with HLS

@bgamari
Copy link
Author

bgamari commented Jun 22, 2021

Thanks @xich! This isn't urgent but the sooner it can be done the sooner users migrating to 9.2 can benefit.

@chessai
Copy link

chessai commented Jul 13, 2021

Please note that it is actually 9.4 - however, the change is going to be reverted and postponed until at least 9.6, possibly later. If retrie could come to handle this change in the meantime, that would greatly benefit the haskell community at large.

@Kleidukos
Copy link

9.4 is about to be released, I think it's a good time to get things going on that front. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants