@@ -9,20 +9,23 @@ Their types are _context function types_. Here is an example of a context functi
9
9
``` scala
10
10
type Executable [T ] = ExecutionContext ?=> T
11
11
```
12
- Context function are written using ` ?=> ` as the "arrow" sign.
12
+ Context functions are written using ` ?=> ` as the "arrow" sign.
13
13
They are applied to synthesized arguments, in
14
- the same way methods with context parameters is applied. For instance:
14
+ the same way methods with context parameters are applied. For instance:
15
15
``` scala
16
16
given ec as ExecutionContext = ...
17
17
18
- def f (x : Int ): Executable [Int ] = ...
18
+ def f (x : Int ): ExecutionContext ?=> Int = ...
19
+
20
+ // could be written as follows with the type alias from above
21
+ // def f(x: Int): Executable[Int] = ...
19
22
20
23
f(2 )(using ec) // explicit argument
21
24
f(2 ) // argument is inferred
22
25
```
23
26
Conversely, if the expected type of an expression ` E ` is a context function type
24
27
` (T_1, ..., T_n) ?=> U ` and ` E ` is not already an
25
- context function literal, ` E ` is converted to an context function literal by rewriting to
28
+ context function literal, ` E ` is converted to a context function literal by rewriting it to
26
29
``` scala
27
30
(using x_1 : T1 , ..., x_n : Tn ) => E
28
31
```
@@ -59,7 +62,7 @@ the aim is to construct tables like this:
59
62
}
60
63
}
61
64
```
62
- The idea is to define classes for ` Table ` and ` Row ` that allow
65
+ The idea is to define classes for ` Table ` and ` Row ` that allow the
63
66
addition of elements via ` add ` :
64
67
``` scala
65
68
class Table {
0 commit comments