Skip to content

Instantly share code, notes, and snippets.

@ngbinh
Last active August 29, 2015 14:19
Show Gist options
  • Save ngbinh/5ad70eab8b67167e350c to your computer and use it in GitHub Desktop.
Save ngbinh/5ad70eab8b67167e350c to your computer and use it in GitHub Desktop.
Model ADT
sealed trait Id[T <: Id[T]]
trait Mid[T <: Mid[T]] extends Id[Mid[T]]
trait Sid[T <: Mid[T]] extends Id[Sid[T]]
case class AMid() extends Mid[AMid]
case class CSid() extends Sid[AMid]
// I wish to get rid of the _
case class E[T <: Sid[_]](s: T) extends Id[E[T]]
val amid = AMid()
val csid = CSid()
val e = E(csid)
def unapply(): Option[E[_]] = {
Some(e)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment