Skip to content

Fix #815: remove dependency on cats-effect from monix-execution#822

Merged
alexandru merged 4 commits into
monix:masterfrom
oleg-py:fix-815
Feb 10, 2019
Merged

Fix #815: remove dependency on cats-effect from monix-execution#822
alexandru merged 4 commits into
monix:masterfrom
oleg-py:fix-815

Conversation

@oleg-py
Copy link
Copy Markdown
Collaborator

@oleg-py oleg-py commented Feb 1, 2019

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-execution does not define one, it can be defined in a separate project (monix-catnap defined one for monix.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.

@oleg-py oleg-py requested a review from alexandru February 1, 2019 20:37

import scala.concurrent.ExecutionContext

package object execution {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the hacky bit. It might seem innocent, but note that it's actually in the catnap subproject.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an awesome hack if it allows us to keep the instances comfortable while removing the Cats-Effect dependency from monix-execution.

@oleg-py
Copy link
Copy Markdown
Collaborator Author

oleg-py commented Feb 2, 2019

Build is failing due to MiMa, I want to get opinion on the method used before I add exclusions

Copy link
Copy Markdown
Member

@alexandru alexandru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oleg-py this looks pretty good, love the package object hack.

I did not do a careful review of everything, but seems to be fine. Please wrap it up.

@alexandru alexandru merged commit f2fbb5d into monix:master Feb 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants