File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
compiler/src/dotty/tools/dotc/printing Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -54,10 +54,21 @@ object Formatting {
5454 object Show extends ShowImplicits1 :
5555 inline def apply [A ](using inline z : Show [A ]): Show [A ] = z
5656
57+ given [X : Show ]: Show [Option [X ]] with
58+ def show (x : Option [X ]) = new CtxShow :
59+ def run (using Context ) = x.map(show1)
60+ end given
61+
5762 given [X : Show ]: Show [Seq [X ]] with
5863 def show (x : Seq [X ]) = new CtxShow :
5964 def run (using Context ) = x.map(show1)
6065
66+ given [K : Show , V : Show ]: Show [Map [K , V ]] with
67+ def show (x : Map [K , V ]) = new CtxShow :
68+ def run (using Context ) =
69+ x.map((k, v) => s " ${show1(k)} => ${show1(v)}" )
70+ end given
71+
6172 given [H : Show , T <: Tuple : Show ]: Show [H *: T ] with
6273 def show (x : H *: T ) = new CtxShow :
6374 def run (using Context ) = show1(x.head) *: Show [T ].show(x.tail).ctxShow.asInstanceOf [Tuple ]
You can’t perform that action at this time.
0 commit comments