Last active
April 21, 2021 22:16
-
-
Save deanwampler/0a3685df0763b9cd03f8f6fe4e5972e6 to your computer and use it in GitHub Desktop.
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
object O1: | |
val name = "O1" | |
def m(s: String) = s"$s, hello from $name" | |
class C1 | |
class C2 | |
given c1: C1 = new C1 // The type annotation ": C1" is required for givens. | |
given c2: C2 = new C2 // same. | |
// Scala 2 uses _ as the wild card instead of *. You can still use _ in 3.0. | |
import O1.* // Import everything EXCEPT the givens, c1 and c2 | |
import O1.given // Import ONLY the givens (of type C1 and C2) | |
import O1.{given, *} // Import everything, givens and non-givens in O1 | |
import O1.{given C1} // Import just the given of type C1 | |
import O1.c2 // Import just the given c2 of type C2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment