Skip to content

Instantly share code, notes, and snippets.

@markehammons
Created June 24, 2013 01:49
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 markehammons/a04ed5458657bd0e4e5c to your computer and use it in GitHub Desktop.
Save markehammons/a04ed5458657bd0e4e5c to your computer and use it in GitHub Desktop.
How do we get over this hump?
trait Height[T[_], U] {
def self: T[U]
def height: Int
def getter(i: Int): U
}
object Height {
implicit class ListHeight[T](val self: List[T]) extends Height[List,T] {
def height = self.size
def getter(i: Int) = self(i)
}
}
// Doesn't compile
def fn[U,T[_] <% Height[T,U]](t: T[U]) = t.getter(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment