File tree 1 file changed +12
-0
lines changed
compiler/src/dotty/tools/dotc/printing
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -54,10 +54,22 @@ 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 match
60
+ case Some (x) => i " Some( $x) "
61
+ case None => " None"
62
+ end given
63
+
57
64
given [X : Show ]: Show [Seq [X ]] with
58
65
def show (x : Seq [X ]) = new CtxShow :
59
66
def run (using Context ) = x.map(show1)
60
67
68
+ given [X : Show , Y : Show ]: Show [Map [X , Y ]] with
69
+ def show (x : Map [X , Y ]) = new CtxShow :
70
+ def run (using Context ) = x.map((x, y) => i " $x => $y" )
71
+ end given
72
+
61
73
given [H : Show , T <: Tuple : Show ]: Show [H *: T ] with
62
74
def show (x : H *: T ) = new CtxShow :
63
75
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