Skip to content

Commit 861ec2a

Browse files
committed
More review additions
1 parent c632d53 commit 861ec2a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

docs/_docs/reference/contextual/derivation.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ For a class/trait/object/enum `DerivingType[T_1, ..., T_N] derives TC`, a derive
4141

4242
The general "shape" of the derived instance is as follows:
4343
```scala
44-
given [...]: TC[ ... DerivingType[...] ... ] = TC.derived
44+
given [...](using ...): TC[ ... DerivingType[...] ... ] = TC.derived
4545
```
4646
`TC.derived` should be an expression that conforms to the expected type on the left, potentially elaborated using term and/or type inference.
4747

@@ -64,6 +64,9 @@ given [T_1: TC, ..., T_N: TC]: TC[DerivingType[T_1, ..., T_N]] = TC.derived
6464

6565
This is the most common case, and is the one that was highlighted in the introduction.
6666

67+
**Note:** The `[T_i: TC, ...]` introduces a `(using TC[T_i], ...)`, more information in [Context Bounds](./context-bounds.md).
68+
This allows the `derived` member to access these evidences.
69+
6770
**Note:** If `N == 0` the above means:
6871
```scala
6972
given TC[DerivingType] = TC.derived
@@ -116,6 +119,7 @@ given [T_1, ... T_(N-K)]: TC[[A_1, ..., A_K] =>> DerivingType[T_1, ... T_(N-K),
116119
We have therefore: `DerivingType[T_1, ..., T_N] derives CanEqual`.
117120

118121
Let `U_1`, ..., `U_M` be the parameters of `DerivingType` of kind `*`.
122+
(These are a subset of the `T_i`s)
119123

120124
The generated instance is then:
121125
```scala

0 commit comments

Comments
 (0)