You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/case-studies/parser/applicative.md
+2-4Lines changed: 2 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,12 +19,10 @@ Define an extension method `flatten`, and an instance of `Flattener` for a neste
19
19
20
20
<divclass="solution">
21
21
~~~scala
22
-
extension [A, B, C](in: ((A, B), C)) {
22
+
extension [A, B, C](in: ((A, B), C))
23
23
defflatten: (A, B, C) =
24
-
in match {
24
+
in match
25
25
case ((a, b), c) => (a, b, c)
26
-
}
27
-
}
28
26
~~~
29
27
30
28
It's fairly straightforward to define this class, but we can't abstract over it in any way. If we want to define `flatten` for a tuple like `(a, (b, c))` we need to define a new extension method. Similarly if we want to flatten a tuple with four elements.
0 commit comments