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

Create a migration scalafix #1049

Closed
djspiewak opened this issue Aug 7, 2020 · 4 comments · Fixed by #1686
Closed

Create a migration scalafix #1049

djspiewak opened this issue Aug 7, 2020 · 4 comments · Fixed by #1686

Comments

@djspiewak
Copy link
Member

I have no idea how scalafix stuff works, but given it's limitations, I do suspect it can handle most of the 2 -> 3 migration in many cases. At least it's worth a shot!

@fthomas
Copy link
Member

fthomas commented Feb 10, 2021

I've a basic skeleton for the migration scalafix ready at series/3.x...fthomas:topic/scalafix which now needs to be filled with patches.

I'm aware of the following changes, that could be added to the scalafix:

  • Bracket -> MonadCancel
  • Bracket#guarantee(a)(b) -> MonadCancel#guarantee(a, b)

Which other changes should it rewrite?

@djspiewak
Copy link
Member Author

djspiewak commented Feb 11, 2021

Ooooooh huzzah!

Other random changes:

  • async -> async_ in many cases (and cancelableF -> async, as well as the other variations of it)
  • suspend -> defer
  • F.uncancelable(fa) -> F.uncancelable(_ => fa)
  • join -> joinAndEmbed (actually joinWithNever - correction by @kubukoz)
  • ExitCase -> Outcome
  • Some package name changes (e.g. Semaphore was in concurrent and is now in std; Ref and Deferred are in cats.effect)
  • Resource#parZip -> both
  • Delete ContextShift entirely
  • Delete Blocker entirely
  • Any concrete-type implicit constraints (such as Concurrent[IO]) can be deleted entirely because they're now universally available
  • blocker.delay(...) needs to be Sync[F].blocking(...), though that might not be possible, depending on whether or not you can figure out the type of blocker
  • It's too bad it's probably impossible to help people out with ExecutionContexts they've been passing around in lieu of the new executionContext effect
  • ContextShift[F].shift -> Spawn[F].cede. This is a slightly weird one because shift also does other things, but I'd wager that 99% of the time when people use it, they mean what cede now does
  • async(...).guarantee(shift) can just be async(...)
  • There is some restructuring and renaming within the Outcome algebra vis-a-vis ExitCase. Completed vs Succeeded(_), for example
  • I don't think there's any way to automatically migrate continual

I think those are the biggest differences that can be automatically migrated? I'll probably think of some more things later.

@fthomas
Copy link
Member

fthomas commented Feb 11, 2021

Thanks Daniel, this will keep me busy for a while. rolling up my sleeves

@djspiewak
Copy link
Member Author

Thank you so much for tackling this!

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

Successfully merging a pull request may close this issue.

2 participants