We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 8817f4c + 415525d commit b85a951Copy full SHA for b85a951
docs/docs/reference/dependent-function-types.md
@@ -6,11 +6,14 @@ title: "Dependent Function Types"
6
A dependent function type describes functions where the result type may depend
7
on the function's parameter values. Example:
8
9
- class Entry { type Key; key: Key }
+ trait Entry { type Key; val key: Key }
10
11
def extractKey(e: Entry): e.Key = e.key // a dependent method
12
val extractor: (e: Entry) => e.Key = extractKey // a dependent function value
13
-
+ // ║ ⇓ ⇓ ⇓ ⇓ ⇓ ⇓ ⇓ ║
14
+ // ║ Dependent ║
15
+ // ║ Function Type ║
16
+ // ╚═══════════════════╝
17
Scala already has _dependent methods_, i.e. methods where the result
18
type refers to some of the parameters of the method. Method
19
`extractKey` is an example. Its result type, `e.key` refers its
0 commit comments