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

Misleading error for type class instances related to Future #670

Closed
lambdista opened this issue Nov 17, 2015 · 2 comments
Closed

Misleading error for type class instances related to Future #670

lambdista opened this issue Nov 17, 2015 · 2 comments

Comments

@lambdista
Copy link
Contributor

When using Future-related type classes you get a misleading error: could not find implicit value for parameter instance.... It's as if it cannot find an instance of the given type class for Future in scope when it actually cannot just find an ExecutionContext. Example, with a REPL session, for Functor:

scala> import scala.concurrent.Future
import scala.concurrent.Future

scala> import cats.Functor
import cats.Functor

scala> import cats.std.future._
import cats.std.future._

scala> Functor[Future].map(Future.successful(42))(_ + 1)
<console>:16: error: could not find implicit value for parameter instance: cats.Functor[scala.concurrent.Future]
       Functor[Future].map(Future.successful(42))(_ + 1)
              ^

but after importing the default ExecutionContext it works:

scala> import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.ExecutionContext.Implicits.global

scala> Functor[Future].map(Future.successful(42))(_ + 1)
res1: scala.concurrent.Future[Int] = scala.concurrent.impl.Promise$DefaultPromise@6335ab80
@ceedubs
Copy link
Contributor

ceedubs commented Nov 17, 2015

For reference, here is a Gitter conversation that happened about this.

@armanbilge
Copy link
Member

Future instances are deprecated now via #4230.

@armanbilge armanbilge closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2022
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

No branches or pull requests

3 participants