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

Instance classes are recreated every time they're summoned #96

Closed
neko-kai opened this issue Oct 20, 2019 · 0 comments
Closed

Instance classes are recreated every time they're summoned #96

neko-kai opened this issue Oct 20, 2019 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@neko-kai
Copy link
Member

neko-kai commented Oct 20, 2019

Because we're using implicit defs for type parameter polymorphism. We should cache the instances in lazy val and cast them, like some other libraries like monix do:

implicit def concurrentInstance[R]: Concurrent[RIO[R, *]] =
  concurrentInstance0.asInstanceOf[Concurrent[RIO[R, *]]

private[this] lazy val concurrentInstance0: Concurrent[RIO[Any, *]] = 
  new CatsConcurrent[Any]
@neko-kai neko-kai added enhancement New feature or request good first issue Good for newcomers labels Oct 20, 2019
neko-kai added a commit to 7mind/interop-cats that referenced this issue Nov 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant