Skip to content

Instantly share code, notes, and snippets.

@PiotrJander
Created September 24, 2019 12:58
Show Gist options
  • Save PiotrJander/441236d3bf7e4950d6fea62a4b1582db to your computer and use it in GitHub Desktop.
Save PiotrJander/441236d3bf7e4950d6fea62a4b1582db to your computer and use it in GitHub Desktop.
// Suppose that `ComponentB` requires capabilities `ServiceC` and `ServiceD`,
// and that it internally uses a `ComponentA`. Is there any way `ComponentB`
// can pass its capabilities to `ComponentA`?
trait ServiceC
trait LiveServiceC extends ServiceC
trait ServiceD
trait LiveServiceD extends ServiceD
class ComponentA { this: ServiceC =>
}
class ComponentB { this: ServiceC with ServiceD =>
val a = new ComponentA with ???
}
new ComponentB with LiveServiceC with LiveServiceD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment