Last active
October 7, 2021 10:11
-
-
Save tarao/3948b0d229a350bc554b86edb0aef7e6 to your computer and use it in GitHub Desktop.
Scala 3.0.2 ClassCastException
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Example { | |
import scala.collection.IterableOps | |
import scala.language.implicitConversions | |
case class Cell[A](value: A) | |
object Cell { | |
implicit def toSeq[A, It[X] <: IterableOps[X, It, It[X]]]( | |
cell: Cell[It[A]] | |
): Seq[A] = cell.value.to(Seq) | |
} | |
implicit class Ops[A, It[X] <: IterableOps[X, It, It[X]]]( | |
private val it: It[A] | |
) extends AnyVal { | |
def cell(): Cell[It[A]] = Cell(it) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val l = List(1, 2, 3) | |
val ll = l.cell().map(i => i * i) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Workaround:
or
or
or replace
implicit class
withextension