Created
February 26, 2021 19:59
-
-
Save deanwampler/7fe65565c8d4974e3188308446dbd887 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Input a sequence of any element type and constructs a string: | |
def tos(seq: Seq[?]): String = seq.mkString("[", ", ", "]") | |
tos(Vector(1,2,3)) // "[1, 2, 3]" | |
// A reminder of given imports, but specifically how to import all | |
// givens of a parameterized type: | |
trait Marker[T] | |
object Obj: | |
given Marker[Int] with {} | |
given Marker[List[?]] with {} | |
import Obj.{given Marker[Int]} // Import just the Marker[Int] | |
import Obj.{given Marker[?]} // Import all given Markers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment