Skip to content

Instantly share code, notes, and snippets.

@devth
Created August 31, 2012 21:01
Show Gist options
  • Save devth/3558934 to your computer and use it in GitHub Desktop.
Save devth/3558934 to your computer and use it in GitHub Desktop.
scala> trait B { def build: Int }
defined trait B
scala> case class B1() extends B { val build = 1 }
defined class B1
scala> case class B2() extends B { val build = 2 }
defined class B2
scala> val l: List[() => B] = List(B1, B2)
l: List[() => B] = List(B1, B2)
scala> case class B3(implicit i: Int) extends B { val build = i }
defined class B3
scala> val l2: List[() => B] = List(B1, B2, B3)
<console>:14: error: type mismatch;
found : B3.type (with underlying type object B3)
required: () => B
val l2: List[() => B] = List(B1, B2, B3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment