Skip to content

Commit d770fb8

Browse files
committed
Explain expansion of type aliases in types with context bounds
1 parent 9d71e3e commit d770fb8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

content/typeclasses-syntax.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,14 @@ val less: Comparer = [X] => (x: X, y: X) => (ord: Ord[X]) ?=>
213213
ord.compare(x, y) < 0
214214
```
215215

216+
The expansion of using clauses does look inside alias types. For instance,
217+
here is a variation of the previous example that uses a parameterized type alias:
218+
```scala
219+
type Cmp[X] = (x: X, y: X) => Ord[X] ?=> Boolean
220+
type Comparer2 = [X: Ord] => Cmp[X]
221+
```
222+
The expansion of the right hand side of `Comparer2` expands the `Cmp[X]` alias
223+
and then inserts the context function at the same place as what's done for `Comparer`.
216224

217225
### 6. Cleanup of Given Syntax
218226

0 commit comments

Comments
 (0)