Skip to content

Union types don't get widened within a type lambda  #9479

Closed
@LukaJCB

Description

@LukaJCB

Minimized code

trait Applicative[F[_]]

def traverse[F[_]: Applicative, A, B](as: List[A])(f: A => F[B]) = ???

implicit def eitherApplicative[A]: Applicative[[X] =>> Either[A, X]] = ???

traverse(List(1, 2))(i => if (true) Right(i) else Left(i))

Output

no implicit argument of type Applicative[([X0] =>> Right[Nothing, X0] | Left[Int, X0])] was found for an implicit parameter of method traverse

Expectation

This should compile fine as it does in Scala 2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions