Skip to content

Instantly share code, notes, and snippets.

View jivanic-demystdata's full-sized avatar
😀

Jules Ivanic jivanic-demystdata

😀
View GitHub Profile
@ghostdogpr
ghostdogpr / Derivation.scala
Last active February 8, 2025 08:46
Sum Type Derivation
import scala.annotation.nowarn
import scala.deriving.Mirror
trait TC[A] {
def show(a: A): Unit
}
@nowarn
inline def gen[A](using m: Mirror.SumOf[A]): TC[A] = {
val subTypes = compiletime.summonAll[Tuple.Map[m.MirroredElemTypes, TC]]