-
Notifications
You must be signed in to change notification settings - Fork 185
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
Create rewrite rule to upgrade from cats.data.Xor to Either #29
Comments
Quick pointers on how to get started with semantic rewrites:
Unfortunately, I don't have more time tonight to take a look at this. But I'm happy to answer any questions tomorrow and in the coming week. |
After doing some initial work yesterday I am leaning towards implementing base rewrites first, then combining them for specific refactorings. In this case the following seem helpful and re-usable:
|
Prototype implementation of this rewrite: master...olafurpg:xor The trick is mainly twofold:
This approach seems to decently handle tricky cases like nested type parameters and it's agnostic to whether the user typed |
Bravo! Very keen to see how this turns out :-) |
@milessabin This is actually in master now, but probably won't stay there long. My intention was only to add it as a proof of concept, longer term rewrites need to live in the libraries themselves. |
Correct. The implementation in master is there to serve as a test that such rewrites are possible to implement with scalafix. Scalafix 0.3.0 has now been released and I added some docs on how to get started with writing and running custom rewrites here: https://scalacenter.github.io/scalafix/#sbt-scalahost The docs are still slim on details, if you are interested to learn more don't hesitate to stop by on gitter. I think we can close this issue. |
Skip validation if there are no sources to fix.
Cats has removed Xor in 0.8 series and migrated to Either now that Either is right biased in Scala 2.12.
The text was updated successfully, but these errors were encountered: