Created
April 18, 2017 16:59
-
-
Save biboudis/721aaf184d3e0cbb1f47290b76afe40d to your computer and use it in GitHub Desktop.
Adding a fluent API to a tagless interpreter via implicit function types
This file contains hidden or 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
object Fluent { | |
trait Foo[C[_]] { | |
def meth1[T]() : C[T] | |
} | |
trait ConcreteC[T] | |
class Lib[ElemT]{ | |
type Context[C[_], Alg[C] <: Foo[C], Elem] = implicit Alg[C] => C[Elem] | |
def a : Context[ConcreteC, Foo[ConcreteC], ElemT] = implicitly[Foo[ConcreteC]] | |
def meth1() : Context[Foo[ConcreteC], ElemT] = a.meth1() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment