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/contextual/givens.md
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -48,6 +48,17 @@ given [T](using Ord[T]) as Ord[List[T]] { ... }
48
48
If the name of a given is missing, the compiler will synthesize a name from
49
49
the implemented type(s).
50
50
51
+
**Note** The name synthesized by the compiler is chosen to be readable and reasonably concise. For instance, the two instances above would get the names:
52
+
```scala
53
+
given_Ord_Int
54
+
given_Ord_List_T
55
+
```
56
+
The precise rules for synthesizing names are found in [./relationship-implicit.html]. These rules do not guarantee absence of name conflicts between
57
+
given instances of types that are "too similar". To avoid conflicts one can
58
+
use named instances.
59
+
60
+
**Note** To ensure robust binary compatibility, publicly available libraries should prefer named instances.
61
+
51
62
## Alias Givens
52
63
53
64
An alias can be used to define a given instance that is equal to some expression. E.g.:
0 commit comments