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: docs/docs/reference/other-new-features/tupled-function.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,15 +11,15 @@ Now that we have functions and tuples generalized to [arities above 22](https://
11
11
The type class `TupleFunction` provides a way to abstract directly over a function of any arity converting it to an equivalent function that receives all arguments in a single tuple.
12
12
13
13
```scala
14
-
/** Type class relating a `FunctionN[..., R]` with an equvalent tupled function `Function1[TupleN[...], R]`
14
+
/** Type class relating a `FunctionN[..., R]` with an equivalent tupled function `Function1[TupleN[...], R]`
15
15
*
16
16
* @tparamF a function type
17
17
* @tparamG a tupled function type (function of arity 1 receiving a tuple as argument)
18
18
*/
19
19
@implicitNotFound("${F} cannot be tupled as ${G}")
20
20
sealedtraitTupledFunction[F, G] {
21
-
deftuple(f: F):G
22
-
defuntuple(g: G):F
21
+
deftupled(f: F):G
22
+
defuntupled(g: G):F
23
23
}
24
24
```
25
25
@@ -43,7 +43,7 @@ Examples
43
43
* @tparamArgs the tuple type with the same types as the function arguments of F
`TupledFunction` can be used to generalize the `Function.untupled` methods to functions of any arities ([full example](https://github.com/lampepfl/dotty/tests/run/tupled-function-untupled.scala))
`TupledFunction` can also be used to generalize the [`Tuple1.compose`](https://github.com/lampepfl/dotty/tests/run/tupled-function-compose.scala) and [`Tuple1.andThen`](https://github.com/lampepfl/dotty/tests/run/tupled-function-andThen.scala) methods to compose functions of larger arities and with functions that return tuples.
@@ -73,6 +73,6 @@ def (f: Args => R) untupled[F, Args <: Tuple, R] given (tf: TupledFunction[F, Ar
0 commit comments