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 January 9, 2026 13:27
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]]