Skip to content

Instantly share code, notes, and snippets.

@julienrf
Created January 15, 2016 15:10
Show Gist options
  • Save julienrf/db8045606693c16c3cf1 to your computer and use it in GitHub Desktop.
Save julienrf/db8045606693c16c3cf1 to your computer and use it in GitHub Desktop.
dependent types + higher-kinded types + implicits
object OK {
trait `*`[A]
trait Bar {
type Qux
implicit val `*`: `*`[Qux]
}
def foo(bar: Bar): `*`[bar.Qux] = {
import bar._
implicitly[`*`[bar.Qux]]
}
}
object KO {
trait `* -> *`[F[_]]
trait Bar {
type Qux[A]
implicit val `* -> *`: `* -> *`[Qux]
}
def foo(bar: Bar): `* -> *`[bar.Qux] = {
import bar._
implicitly[`* -> *`[bar.Qux]]
}
}
@julienrf
Copy link
Author

Fails with the following error:

[error] could not find implicit value for parameter e: KO.* -> *[bar.Qux]
[error]       implicitly[`* -> *`[bar.Qux]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment