Skip to content

Instantly share code, notes, and snippets.

@xfire
Created December 15, 2010 19:43
Show Gist options
  • Save xfire/742493 to your computer and use it in GitHub Desktop.
Save xfire/742493 to your computer and use it in GitHub Desktop.
view bound with type constructor compilation error
trait Foo[TC[_], V]
/* compilation error
* -----------------
* view_bound_error.scala:11: error: type T takes type parameters
* def viewBound[T[V] <% Foo[T, V], V](value: T[V]) = value
* ^
* one error found
*/
def viewBound[T[V] <% Foo[T, V], V](value: T[V]) = value
/* view bound desugaring by hand compiles without problems
* -------------------------------------------------------
*/
def viewBound[T[V], V](value: T[V])(implicit e: T[V] => Foo[T, V]) = value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment