File tree 1 file changed +11
-0
lines changed
compiler/src/dotty/tools/dotc/printing
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -54,10 +54,21 @@ object Formatting {
54
54
object Show extends ShowImplicits1 :
55
55
inline def apply [A ](using inline z : Show [A ]): Show [A ] = z
56
56
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
+
57
62
given [X : Show ]: Show [Seq [X ]] with
58
63
def show (x : Seq [X ]) = new CtxShow :
59
64
def run (using Context ) = x.map(show1)
60
65
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
+
61
72
given [H : Show , T <: Tuple : Show ]: Show [H *: T ] with
62
73
def show (x : H *: T ) = new CtxShow :
63
74
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