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
@@ -98,18 +98,18 @@ If such given instances are anonymous (as in the second clause), their name is s
98
98
99
99
### Given Instances with Collective Parameters
100
100
101
-
If a given instance has several extension methods one can pull out the left parameter section
101
+
If a given instance has no parent but several extension methods one can pull out the left parameter section
102
102
as well as any type parameters of these extension methods into the given instance itself.
103
103
For instance, here is a given instance with two extension methods.
104
104
```scala
105
-
givenListOps {
105
+
givenlistOps: {
106
106
def (xs: List[T]) second[T]:T= xs.tail.head
107
107
def (xs: List[T]) third[T]:T= xs.tail.tail.head
108
108
}
109
109
```
110
110
The repetition in the parameters can be avoided by moving the parameters into the given instance itself. The following version is a shorthand for the code above.
111
111
```scala
112
-
givenListOps[T](xs: List[T]) {
112
+
givenlistOps:[T](xs: List[T]) {
113
113
defsecond:T= xs.tail.head
114
114
defthird:T= xs.tail.tail.head
115
115
}
@@ -168,6 +168,7 @@ to the [current syntax](../../internals/syntax.md).
168
168
```
169
169
DefSig ::= ...
170
170
| ‘(’ DefParam ‘)’ [nl] id [DefTypeParamClause] DefParamClauses
0 commit comments