File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
docs/docs/reference/new-types Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ use of the match type as the return type):
6767def leafElem [X ](x : X ): LeafElem [X ] = x match
6868 case x : String => x.charAt(0 )
6969 case x : Array [t] => leafElem(x(9 ))
70- case x : Iterable [t] => leafElem(x.next() )
70+ case x : Iterable [t] => leafElem(x.head )
7171 case x : AnyVal => x
7272```
7373
Original file line number Diff line number Diff line change 1+ type LeafElem [X ] = X match
2+ case String => Char
3+ case Array [t] => LeafElem [t]
4+ case Iterable [t] => LeafElem [t]
5+ case AnyVal => X
6+
7+ def leafElem [X ](x : X ): LeafElem [X ] = x match
8+ case x : String => x.charAt(0 )
9+ case x : Array [t] => leafElem(x(9 ))
10+ case x : Iterable [t] => leafElem(x.head)
11+ case x : AnyVal => x
You can’t perform that action at this time.
0 commit comments