Open bontaq opened 3 years ago
Not automagically, but (without trying it), I would approach it something like this:
You have:
module A where
data MyThing = MyThing { words :: [String] }
Add a new module:
module B where
data TheirThing = MyThing { words :: [String] }
Then edit module A:
module A where
import B
type MyThing = TheirThing
Typecheck your program to make sure this didn't break anything.
Then run retrie: retrie --type-forward A.MyThing --import "import B"
Which will change all the type-level MyThing
s to TheirThing
s and add the import to B wherever that edit is made.
Then typecheck to make sure everything still builds.
Then run retrie again: retrie --adhoc "MyThing = TheirThing"
Which should edit the constructors.
Then delete module A and all the imports of A (latter with grep/sed if needed). (#33 is open to add more complex import edits eventually.)
Hi, I've been using retrie for doing some refactoring in a project and it's quite nice.
I'm wondering what steps one would take to do something like:
across a whole project, including imports. Is that possible? :pray: