Created
January 16, 2014 18:47
-
-
Save ldacosta/8460909 to your computer and use it in GitHub Desktop.
Let's suppose that I have an abstract trait for which I have 'n' (> 2) concrete implementations. When I mix those traits, I want to have an elegant way to create concrete classes. See below.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// define mixable traits: | |
trait T | |
trait T1 extends T | |
trait T2 extends T | |
... | |
trait T100 extends T | |
// now let's mix them: | |
trait anotherT extends T | |
// and create concrete classes. | |
// THIS IS THE PART NOT COOL. Is there any way to do the following, better? | |
case class anotherT1 extends anotherT with T1 | |
case class anotherT2 extends anotherT with T2 | |
... | |
case class anotherT100 extends anotherT with T100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OK, let's see if I understand.
Basically
And we are a couple of twists (as you show) we can default values for that implicit.