Skip to content

Deriving TagKK[F[Either]] with TagK[F] in context (scala 2.13 only) #515

Description

@road21

This code is not compiling in scala 2.13.16:

import izumi.reflect.{TagK, TagKK, HKTag}

type Mono[F[_], x, y] = F[Either[x, y]]

def foo[F[_]: TagK]: TagKK[Mono[F, *, *]]] =
  implicitly // compiler error: could not find implicit value for parameter e: izumi.reflect.TagKK[[β$0$, γ$1$]F[scala.util.Either[β$0$,γ$1$]]]

The same code is compiling in scala 3 without compiler errors:

//> using scala 3.6.2
//> using dep "dev.zio::izumi-reflect:3.0.0"
import izumi.reflect.{TagK, TagKK, HKTag}

type Mono[F[_], x, y] = F[Either[x, y]]

def foo[F[_]: TagK]: TagKK[[x, y] =>> Mono[F, x, y]] = 
  implicitly // ok

As a workaround type Mono[F[_], x, y] >: F[Either[x, y]] <: F[Either[x, y]] works.

Scastie: https://scastie.scala-lang.org/road21/j3t7ODHHQzqjYW0hPysctg/30

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions