Fix #815: remove dependency on cats-effect from monix-execution#822
Merged
Conversation
oleg-py
commented
Feb 1, 2019
|
|
||
| import scala.concurrent.ExecutionContext | ||
|
|
||
| package object execution { |
Collaborator
Author
There was a problem hiding this comment.
This is the hacky bit. It might seem innocent, but note that it's actually in the catnap subproject.
Member
There was a problem hiding this comment.
This is an awesome hack if it allows us to keep the instances comfortable while removing the Cats-Effect dependency from monix-execution.
Collaborator
Author
|
Build is failing due to MiMa, I want to get opinion on the method used before I add exclusions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Basically all the usages of cats-effect in execution are removed as discussed in #815.
For CancelableFuture instances, I've used a little known fact that package objects of parent packages are part of an implicit scope for type. That means if
monix-executiondoes not define one, it can be defined in a separate project (monix-catnap defined one formonix.execution). Instances are immediately available without any extra imports, if you have catnap dependency.This is an obscure hack, but it gives the best UX as in no extra imports are required. OTOH, it can be used to provide extension methods too. I've refrained from pushing it too hard for now.
I decided also to provide factories for Scheduler - cats-effect datatypes (
SchedulerEffect, suggestion for better name are welcome) without syntax extensions - syntax doesn't really buy you much.In #815, I forgot to mention Cancelable#toCancelToken. It has an optimization for dummy cancelables. We use it three times where it seems like it would not hit that optimization - scheduler calls and CancelableFuture usage.