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: scala3/scaladoc.md
-66Lines changed: 0 additions & 66 deletions
Original file line number
Diff line number
Diff line change
@@ -67,72 +67,6 @@ This feature is provided by [Inkuire](https://github.com/VirtusLab/Inkuire) sear
67
67
Note that this feature is still in development, so it can be subject to considerable change.
68
68
If You encounter a bug or have an idea for improvement don't hesitate to create an issue on [Inkuire](https://github.com/VirtusLab/Inkuire/issues/new) or [dotty](https://github.com/lampepfl/dotty/issues/new).
69
69
70
-
71
-
Using this feature allows to find `def`s and `val`s from the documented code.
72
-
73
-
In order for a scaladoc searchbar query to be searched using Inkuire instead of the default search engine, the query has to contain `=>` character sequence.
74
-
75
-
Accepted input is similar to a curried function signature in Scala 3. With some differences:
76
-
- AndTypes, OrTypes and Functions have to be enclosed in parentheses e.g. `(Int & Any) => String`
77
-
- Transformations without any input can be found by a syntactic by name call e.g. `=> Int`
78
-
- A wildcard `_` can be used to indicate that we want to match any type in a given place e.g. `Long => Double => _`
79
-
- Types in the form of single letter e.g. `A` or a letter with a digit `X1` are automatically assumed to be type variables
80
-
- Other type variables can be declared just like in polymorphic functions e.g. `[A, B] => A => B => A`
81
-
82
-
Some examples to give You a better idea:
83
-
-`List[Int] => (Int => Long) => List[Long]`
84
-
-`(A, B) => A`
85
-
-`Set[Long] => Long => Boolean`
86
-
-`Int => Long => Int`
87
-
-`String => Int => Char`
88
-
-`(Int & Float) => (String | Double)`
89
-
90
-
Inkuire works as a JavaScript worker in the browser thanks to the power of [ScalaJS](https://www.scala-js.org/).
91
-
92
-
To enable Inkuire when running scaladoc add flag `-Ygenerate-inkuire`. By adding this flag two files are generated:
93
-
-`inkuire-db.json` - this is the file containing all searchable declarations from the currently documented project in a format readable to Inkuire search engine.
94
-
-`inkuire-config.json` - this file contains locations of database files that should be searchable from documentation of the current project. By default it will be generated with the location of the local db file as well as default implied locations of detabase files in `External mappings`.
95
-
96
-
When it comes to how the code is mapped to InkuireDb entries, there are some transformations to make the engine more opinionated(though open to suggestions and changes). Firstly the receiver(non-module owner) of a function can be treated as a first argument. Automatic currying is also applied, so that the results aren't dependant on argument lists. When finding matches `val`s and `def`s are not distinguished.
97
-
98
-
So the following declarations should be found by query `Int => Int => Int => Int`:
99
-
```
100
-
class Num:
101
-
def a(i: Int, j: Int): Int
102
-
def b(i: Int)(j: Int): Int
103
-
def c(i: Int): (Int => Int)
104
-
val d: Int => Int => Int
105
-
val e: Int => Int => Int
106
-
val f: (Int, Int) => Int
107
-
end Num
108
-
109
-
def g(i: Num, j: Int, k: Int): Int
110
-
extension (i: Num) def h(j: Int, k: Int): Int
111
-
def i(i: Num, j: Int)(k: Int): Int
112
-
extension (i: Num) def j(j: Int)(k: Int): Int
113
-
...
114
-
```
115
-
116
-
When it comes to type aliases, they are desugared on both the declaration and the query signature. This means that for declarations:
117
-
```
118
-
type Name = String
119
-
120
-
def fromName(name: Name): String
121
-
def fromString(str: String): Name
122
-
```
123
-
both functions (`fromName` and `fromString`) should be found for queries `Name => Name`, `String => String`, `Name => String` and `String => Name`.
124
-
125
-
The edges are the roughest with implicits/givens.
126
-
Implicit conversions are only applied once and only to the receiver/first argument. Since allowing for more than one applicationof implicit conversions poses problems like for example infinite applications of implicit conversions.
127
-
Implicit arguments are ignored at the moment, but we are very much planning on better support for them in near future.
128
-
129
-
Some other things we are still working on:
130
-
- Generating type information (InkuireDB) for Java sources
131
-
- More advanced type level constructs like e.g. explicit type bounds and repeated types
132
-
- Better managing of dependencies using scaladoc external mappings
133
-
- Integration with [Metals](https://scalameta.org/metals/)
Using this feature allows to find `def`s and `val`s from the documented code.
7
+
8
+
In order for a scaladoc searchbar query to be searched using Inkuire instead of the default search engine, the query has to contain `=>` character sequence.
9
+
10
+
Accepted input is similar to a curried function signature in Scala 3. With some differences:
11
+
- AndTypes, OrTypes and Functions have to be enclosed in parentheses e.g. `(Int & Any) => String`
12
+
- Transformations without any input can be found by a syntactic by name call e.g. `=> Int`
13
+
- A wildcard `_` can be used to indicate that we want to match any type in a given place e.g. `Long => Double => _`
14
+
- Types in the form of single letter e.g. `A` or a letter with a digit `X1` are automatically assumed to be type variables
15
+
- Other type variables can be declared just like in polymorphic functions e.g. `[A, B] => A => B => A`
16
+
17
+
Some examples to give You a better idea:
18
+
-`List[Int] => (Int => Long) => List[Long]`
19
+
-`(A, B) => A`
20
+
-`Set[Long] => Long => Boolean`
21
+
-`Int => Long => Int`
22
+
-`String => Int => Char`
23
+
-`(Int & Float) => (String | Double)`
24
+
25
+
Inkuire works as a JavaScript worker in the browser thanks to the power of [ScalaJS](https://www.scala-js.org/).
26
+
27
+
To enable Inkuire when running scaladoc add flag `-Ygenerate-inkuire`. By adding this flag two files are generated:
28
+
-`inkuire-db.json` - this is the file containing all searchable declarations from the currently documented project in a format readable to Inkuire search engine.
29
+
-`inkuire-config.json` - this file contains locations of database files that should be searchable from documentation of the current project. By default it will be generated with the location of the local db file as well as default implied locations of detabase files in `External mappings`.
30
+
31
+
When it comes to how the code is mapped to InkuireDb entries, there are some transformations to make the engine more opinionated(though open to suggestions and changes). Firstly the receiver(non-module owner) of a function can be treated as a first argument. Automatic currying is also applied, so that the results aren't dependant on argument lists. When finding matches `val`s and `def`s are not distinguished.
32
+
33
+
So the following declarations should be found by query `Int => Int => Int => Int`:
34
+
```
35
+
class Num():
36
+
def a(i: Int, j: Int): Int
37
+
def b(i: Int)(j: Int): Int
38
+
def c(i: Int): (Int => Int)
39
+
val d: Int => Int => Int
40
+
val e: Int => Int => Int
41
+
val f: (Int, Int) => Int
42
+
end Num
43
+
44
+
def g(i: Num, j: Int, k: Int): Int
45
+
extension (i: Num) def h(j: Int, k: Int): Int
46
+
def i(i: Num, j: Int)(k: Int): Int
47
+
extension (i: Num) def j(j: Int)(k: Int): Int
48
+
...
49
+
```
50
+
51
+
When it comes to type aliases, they are desugared on both the declaration and the query signature. This means that for declarations:
52
+
```
53
+
type Name = String
54
+
55
+
def fromName(name: Name): String
56
+
def fromString(str: String): Name
57
+
```
58
+
both functions (`fromName` and `fromString`) should be found for queries `Name => Name`, `String => String`, `Name => String` and `String => Name`.
59
+
60
+
The edges are the roughest with implicits/givens.
61
+
Implicit conversions are only applied once and only to the receiver/first argument. Since allowing for more than one applicationof implicit conversions poses problems like for example infinite applications of implicit conversions.
62
+
Implicit arguments are ignored at the moment, but we are very much planning on better support for them in near future.
63
+
64
+
Some other things we are still working on:
65
+
- Generating type information (InkuireDB) for Java sources
66
+
- More advanced type level constructs like e.g. explicit type bounds and repeated types
67
+
- Better managing of dependencies using scaladoc external mappings
68
+
- Integration with [Metals](https://scalameta.org/metals/)
0 commit comments