Arrow 1.2.0 Raise migration script
This migration script attempts to automatically migrate arrow.core.computations.*
and arrow.core.continuations.*
on a best effort to arrow.core.raise.*
.
It has been tested on serveral real-life projects with 100% success, being able to automatically migrate the entire codebase.
The run this kts
script you need kotlinc
install on your machine.
The official documentation on how to install kotlinc
.
Some methods like ensure
in the DSL became top-level, and fold
if you're using Effect
or EagerEffect
.
These new top-level imports cannot be automatically migrated, and there are two ways of dealing with the necessary imports.
There is two ways to use this script for migration:
- Recommended: automatic imports handling, adds too many imports and uses IntelliJ's optimise imports
- Manual imports, doesn't add import for
fold
, andensure
and requires manually importing them on a usage basis.
Recommended usage
Once installed you can run the script with default params: kotlinc -script migrate.main.kts .
.
You need to have Arrow version 1.2.0
(1.1.6-alpha.28
) in order to compile your project after the script finishes running.
The script might leave you with some unused imports, to fix this you can run optimise imports on your project root or src folder.
- Select src or _project root
+
⌃ ⌥ Oor
Ctrl+Alt+O`. - Right-click project root or src in project view, and select Optimise imports
This should remove all unused imports this might also affect other unrelated imports.
Alternative
If you don't want to rely on IntelliJ's optimise imports you can still use the migration script to do 99,99% of the work,
except import ensure
(and fold
for Effect
/EagerEffect
).
Easiest way to fix the imports is run ./gradlew build
and add missing imports in files that fail to compile.
Thank you for using Arrow, and your support. I hope this script was able to simplify your migration process to 2.0.0