Skip to content

Invalid error message on missing given instance #11493

Open
@kubukoz

Description

@kubukoz

Compiler version

3.0.0-RC1

Minimized code

https://github.com/kubukoz/given-repro

// requires cats-effect 3.0.0-RC2 or 2.3.3
// "org.typelevel" %% "cats-effect" % "2.3.3"

import cats.MonadError
import cats.effect.IO

sealed trait Failure extends Throwable

def demo[F[_]](using MonadError[F, Failure]) = ???

def demo2 = demo[IO]

Output

[E] [E1] src/main/scala/Main.scala:8:21
[E]      Could not find an instance of Monad for cats.effect.IO
[E]      L8: def demo2 = demo[IO]
[E]                              ^
[E] src/main/scala/Main.scala: L8 [E1]

Expectation

Something along the lines of

Could not find an instance of MonadError[[a] =>> F[a], Failure] for cats.effect.IO

More context

The typeclass hierarchy is: MonadError[F[_], E] <: Monad[F]. Cats IO has MonadError[IO, Throwable], so Monad[IO] is definitely there.

Metadata

Metadata

Assignees

Labels

area:reportingError reporting including formatting, implicit suggestions, etcbetter-errorsIssues concerned with improving confusing/unhelpful diagnostic messagesdiscussionitype:bugstat:needs minimizationNeeds a self contained minimization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions