Skip to content

Instantly share code, notes, and snippets.

@beezee
Created March 30, 2019 00:22
Show Gist options
  • Save beezee/240ea6b31abc1da0c6b8fe6ffd8cee32 to your computer and use it in GitHub Desktop.
Save beezee/240ea6b31abc1da0c6b8fe6ffd8cee32 to your computer and use it in GitHub Desktop.
some random shit
// 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