Created
March 30, 2019 00:22
-
-
Save beezee/240ea6b31abc1da0c6b8fe6ffd8cee32 to your computer and use it in GitHub Desktop.
some random shit
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
// Start writing your ScalaFiddle code here | |
trait Foo[A] { | |
def apply: A | |
} | |
trait Bar[I] { | |
def apply(i: I): Unit | |
} | |
trait FooBarDependencies {} | |
object FooBarDependencies { | |
def apply[I, A](implicit f: Foo[A], b: Bar[I]) = | |
new FooBarDependencies {} | |
} | |
trait FooBarDependents[I, A] { | |
def foo: Foo[A] | |
def bar: Bar[I] | |
} | |
// on line 13, Foo and Bar are dependencies because they are required for construction | |
// on line 17, construction is a foregone conclusion, and you can access the Foo whose | |
// type is _dependent_ on the member of FooBarDependents, and the Bar whose type is | |
// _dependent_ on the member of FooBarDependents |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment