Skip to content

Instantly share code, notes, and snippets.

@biboudis
Created April 18, 2017 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biboudis/721aaf184d3e0cbb1f47290b76afe40d to your computer and use it in GitHub Desktop.
Save biboudis/721aaf184d3e0cbb1f47290b76afe40d to your computer and use it in GitHub Desktop.
Adding a fluent API to a tagless interpreter via implicit function types
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