Skip to content

Instantly share code, notes, and snippets.

@aereal
Created May 31, 2016 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aereal/4de4cad71de214655fe08886ee1b4c2b to your computer and use it in GitHub Desktop.
Save aereal/4de4cad71de214655fe08886ee1b4c2b to your computer and use it in GitHub Desktop.
trait Bounded[T <: Bounded[T]] {
self: T =>
}
trait BoundedFactory[V, B <: Bounded[B]] {
def build(b: B): V
}
case class Box[V](value: V) extends Bounded[Box[V]]
class BoxFactory[T] extends BoundedFactory[T, Box[T]] {
def build(b: Box[T]) = b.value
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment