-
-
Save markehammons/a04ed5458657bd0e4e5c to your computer and use it in GitHub Desktop.
How do we get over this hump?
This file contains 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
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