Skip to content

Instantly share code, notes, and snippets.

@olafurpg
Created April 25, 2017 16:13
Show Gist options
  • Save olafurpg/33bb4874f83c2784802bfa526bc0cc74 to your computer and use it in GitHub Desktop.
Save olafurpg/33bb4874f83c2784802bfa526bc0cc74 to your computer and use it in GitHub Desktop.
package commandeer
import scala.language.higherKinds
trait CommandeerDSL[Host]
object CommandeerDSL {
def apply[Host, DSL <: CommandeerDSL[Host]](host: Host)(implicit dsl: DSL): DSL = dsl
}
trait Foo
object Foo {
implicit val fooDSL: FooDSL = new FooDSL {}
}
trait FooDSL extends CommandeerDSL[Foo]
object RunMe {
CommandeerDSL(null.asInstanceOf[Foo]) // (Foo.fooDSL)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment