Skip to content

Instantly share code, notes, and snippets.

@lambdista
Created March 17, 2016 11:25
Show Gist options
  • Save lambdista/514397af3a263e82c5ed to your computer and use it in GitHub Desktop.
Save lambdista/514397af3a263e82c5ed to your computer and use it in GitHub Desktop.
case class Operand[A](key: String, value: A)
case class Foo(id: Long, bar: String)
trait Operation[A] {
def operator: String
def operand: Option[Operand[A]]
}
object Operation {
case class FooOperation(foo: Foo) extends Operation[Foo] {
override def operator: String = "foo"
// IntelliJ Community Edition 15.0,4 does not highlight the compilation error for this:
override def operand: Option[Foo] = Some(foo)
// The compilable version is something like the following:
// override def operand: Option[Operand[Foo]] = Some(Operand("someKey", foo))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment