Skip to content

Instantly share code, notes, and snippets.

@rupeshtr78
Created October 26, 2020 01:36
Show Gist options
  • Save rupeshtr78/2b871ab39caf1a40a8b90fdf0fd56c8f to your computer and use it in GitHub Desktop.
Save rupeshtr78/2b871ab39caf1a40a8b90fdf0fd56c8f to your computer and use it in GitHub Desktop.
// Type classes (implicit objects)
def foo2[B, A<:B] (a:A,b:B) = print("OK")
class A;
class B;
implicit def a2b(a:A) = new B
foo2(new A, new B) // implicit conversion!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment