Skip to content

Instantly share code, notes, and snippets.

@deanwampler
Last active April 21, 2021 22:16
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 deanwampler/0a3685df0763b9cd03f8f6fe4e5972e6 to your computer and use it in GitHub Desktop.
Save deanwampler/0a3685df0763b9cd03f8f6fe4e5972e6 to your computer and use it in GitHub Desktop.
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