Skip to content

Commit 44c5b12

Browse files
committed
Tweak docs
1 parent 44cb7a2 commit 44c5b12

File tree

7 files changed

+57
-98
lines changed

7 files changed

+57
-98
lines changed

CHANGES.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1+
Release notes are now [published on GitHub](https://github.com/typelevel/spire/releases).
12

2-
## [Version 0.18.0-M1](https://github.com/typelevel/spire/releases/tag/v0.18.0-M1)
3-
Spire will support Scala 3 since `v0.18.0` and `v0.18.0-M1` is a pre-release including breaking changes toward 0.18.0. For more detail, visit [Release Note](https://github.com/typelevel/spire/releases/tag/v0.18.0-M1).
4-
5-
Since v0.18.0, we track changes in [github releases page](https://github.com/typelevel/spire/releases).
63
## Version 0.16.1-SNAPSHOT
74

85
* Disabled benchmarked depending on Caliper; waiting for migration to a modern benchmarking framework

CODE_OF_CONDUCT.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
People are expected to follow the [Scala Code of Conduct](https://www.scala-lang.org/conduct/)
2-
when discussing Spire on the Github page, in Gitter, the IRC channel,
1+
People are expected to follow the [Typelevel Code of Conduct](https://typelevel.org/code-of-conduct.html)
2+
when discussing Spire on the Github page, in Discord, Gitter, the IRC channel,
33
mailing list, and other official venues.
44

5-
Concerns or issues can be sent to any of Spire's maintainers, or to the
6-
[Typelevel](https://typelevel.org/about.html) organization.
5+
Concerns or issues can be sent to any of Spire's maintainers, or to any of the
6+
[designated CoC contacts](https://typelevel.org/code-of-conduct.html) for Typelevel.

CONTRIBUTING.md

+8-17
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,11 @@ We also gladly accept patches for documentation. Anything from fixing
1313
a typo to writing a full tutorial is a great way to help the
1414
project.
1515

16-
#### Quick guide for documentation
17-
You can directly edit documents at https://github.com/typelevel/spire/tree/main/docs/src/main/mdoc, but it is better to use git to manage diffs.
18-
19-
20-
1. Visit https://github.com/typelevel/spire and fork the repository.
21-
22-
2. Clone the forked repository and make new branch.
23-
24-
3. Run `sbt docs/makeMicrosite` to build document website, change directory to `docs/target/site` and run `jekyll serve -b /spire`.
25-
26-
You can preview website at http://localhost:4000/spire by default.
27-
28-
Note: `makeMicrosite` depends on jekyll 4.x. Make sure that you have [jekyll(4+)](https://jekyllrb.com/docs/installation/) in your environment.
29-
30-
Finally, commit your changes and create PR at typelevel/spire repository.
16+
The documentation lives in the [`docs/src/main/mdoc`](https://github.com/typelevel/spire/tree/main/docs/src/main/mdoc) directory in the repository. To preview the website locally:
3117

18+
1. [Install Jekyll v4](https://jekyllrb.com/docs/installation/).
19+
2. Run `sbt docs/makeMicrosite`. Change directory to `docs/target/site` and run `jekyll serve -b /spire`.
20+
3. Preview website at http://localhost:4000/spire.
3221

3322
### Reporting bugs, issues, or unexpected behavior
3423

@@ -53,7 +42,7 @@ other people's opinions.
5342

5443
### Creating or improving tests
5544

56-
Spire uses [ScalaTest](https://www.scalatest.org) and
45+
Spire uses [munit](https://scalameta.org/munit/) and
5746
[ScalaCheck](https://scalacheck.org/) to test our code. The tests
5847
fulfill a number of important functions:
5948

@@ -88,9 +77,11 @@ not to get merged to main as quickly. For this kind of work, you
8877
should submit a pull request from your branch, but we will probably
8978
leave the PR open for awhile while commenting on it.
9079

91-
You can always ask questions at [Typelevel Discord](https://discord.com/invite/XF3CXcMzqD) or [Spire gitter](https://gitter.im/typelevel/spire), email the list, or visit the `#spire-math` IRC channel
80+
You can always message the `#spire` channel on the [Typelevel Discord](typelevel-discord)
9281
to get a second opinion on your idea or design.
9382

83+
[typelevel-discord]: https://discord.com/invite/XF3CXcMzqD
84+
9485
### Ask questions and make suggestions
9586

9687
Spire strives to be an excellent part of the Scala ecosystem. We

FRIENDS.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
## Friends of Spire
1+
Friends of Spire
22
================
33

44
Here is a list of libraries that are based on Spire, or have Spire compatibility.
55

66
- [Libra](https://to-ithaca.github.io/libra/), dimensional analysis for Scala
7-
- [coulomb](https://github.com/erikerlandson/coulomb) colomb: unit analysis for Scala
8-
- [circe-spire](https://github.com/circe/circe-spire) circe codecs for Spire types
7+
- [coulomb](https://github.com/erikerlandson/coulomb) coulomb: unit analysis for Scala
8+
- [circe-spire](https://github.com/circe/circe-spire) circe encoders and decoders for Spire types
99
- [onnx-scala](https://github.com/EmergentOrder/onnx-scala) An ONNX (Open Neural Network eXchange) API and backend for typeful, functional deep learning in Scala (3)
1010
- [NDScala](https://github.com/SciScala/NDScala) N-dimensional arrays in Scala 3. Think NumPy ndarray, but with compile-time type-checking/inference over shapes, ndarray/axis labels & numeric data types
1111
- [Sonic reducer](https://github.com/rklaehn/sonicreducer), Hierarchical reducer for arbitrary Scala sequences
1212
- [spire-matrix](https://github.com/lJoublanc/spire-matrix), BLAS-backed implementation of `VectorSpace`. See #675. POC/Not for prod use.
13-
- [shapeless-spire](https://mvnrepository.com/artifact/org.typelevel/shapeless-spire)

build.sbt

+10-12
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,7 @@ lazy val docs = project
215215
"VERSION" -> (if (isSnapshot.value)
216216
previousStableVersion.value.getOrElse(version.value)
217217
else
218-
version.value),
219-
"COPYRIGHT_TO" -> java.time.LocalDate.now().getYear().toString(),
220-
"AUTHORS" -> "Erik Osheim, Tom Switzer"
218+
version.value)
221219
),
222220
// NOTE: disable link hygine to supress dead link warnings because mdoc does not go well with Jekyll
223221
mdocExtraArguments ++= Seq("--no-link-hygiene")
@@ -332,26 +330,26 @@ lazy val docSettings = Seq(
332330
micrositeDocumentationUrl := "https://www.javadoc.io/doc/org.typelevel/spire_2.13/latest/spire/index.html",
333331
micrositeDocumentationLabelDescription := "API Documentation",
334332
micrositeExtraMdFiles := Map(
333+
file("AUTHORS.md") -> ExtraMdFileConfig(
334+
"authors.md",
335+
"home",
336+
Map("title" -> "Authors", "section" -> "Home", "position" -> "5")
337+
),
335338
file("CHANGES.md") -> ExtraMdFileConfig(
336339
"changes.md",
337340
"home",
338341
Map("title" -> "Changes", "section" -> "Home", "position" -> "2")
339342
),
340-
// Note: CONTRIBUTING.md, CODE_OF_CONDUCT.md and COPYING is placed in pproject root directory so that github can detect it.
341-
file("CONTRIBUTING.md") -> ExtraMdFileConfig("contributing.md",
342-
"home",
343-
Map("title" -> "Contributing", "section" -> "Home", "position" -> "3")
343+
file("CONTRIBUTING.md") -> ExtraMdFileConfig(
344+
"contributing.md",
345+
"home",
346+
Map("title" -> "Contributing", "section" -> "Home", "position" -> "3")
344347
),
345348
file("DESIGN.md") -> ExtraMdFileConfig(
346349
"design.md",
347350
"home",
348351
Map("title" -> "Design notes", "section" -> "Home", "position" -> "4")
349352
),
350-
file("AUTHORS.md") -> ExtraMdFileConfig(
351-
"authors.md",
352-
"home",
353-
Map("title" -> "Authors", "section" -> "Home", "position" -> "5")
354-
),
355353
file("FRIENDS.md") -> ExtraMdFileConfig(
356354
"friends.md",
357355
"home",

docs/src/main/mdoc/guide.md

+6-12
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,12 @@ behind Spire's generic math capabilities.
123123
#### Specialization
124124

125125
To achieve speed on-par with direct (non-generic) code, you will need
126-
to use specialization.
127-
128-
About specialization, visit [scalac.io blog: Avoiding Unnecessary Object Instantiation with Specialized Generics](https://scalac.io/blog/specialized-generics-object-instantiation/)
129-
130-
The good news is that most of Spire's code is
126+
to use [specialization](specialization). The good news is that most of Spire's code is
131127
already specialized (and tested for proper performance). The bad news
132128
is that you'll have to annotate all your generic code like so:
133129

130+
[specialization]: https://www.scala-lang.org/old/sites/default/files/sids/dragos/Thu,%202010-05-06,%2017:56/sid-spec.pdf
131+
134132
```scala mdoc
135133
object Demo3 {
136134
import spire.algebra._
@@ -154,8 +152,7 @@ There are too many gotchas with specialization to list here. But the
154152
4. Specialization will increase bytecode size by a factor of x2-10.
155153

156154
If you have questions about specialization feel free to ask on the
157-
mailing list or [gitter channel](https://gitter.im/typelevel/spire). You may notice that some code in Spire is structured in
158-
an unusual way, and often this is to make sure specialization works
155+
`#spire` channel on the [Typelevel Discord](https://discord.com/invite/XF3CXcMzqD). You may notice that some code in Spire is structured inan unusual way, and often this is to make sure specialization works
159156
properly.
160157

161158
You may find that it's easy to develop generic code without using
@@ -189,13 +186,11 @@ properties themselves remain the same.
189186

190187
#### Eq
191188

192-
Spire provides an `Eq[A]` type class to represent type-safe
193-
equality. This allows us to talk about types for which there isn't a
189+
Spire uses an `Eq[A]` type class to represent type-safe
190+
equality. This allows us to talk about types for which there isn't a
194191
computationally useful notion of equality, and also to avoid
195192
programming errors caused by universal equality.
196193

197-
It means that comparing two values of incomparable types with `===` operator raises **compile error**, while Scala's standard `==` operator usually raises error at runtime.
198-
199194
`Eq[A]` provides two operators
200195

201196
* `eqv` (`a === b`) equality operator.
@@ -208,7 +203,6 @@ Spire requires that `eqv` obey the laws of an equivalence relation, namely:
208203
* if `a === b` then `a` is `b` (*anti-symmetry*)
209204
* if `a === b` and `b === c` then `a === c` (*transitivity*)
210205

211-
212206
The anti-symmetry property may seem confusing. The idea is that if `a === b`
213207
then `a` and `b` must be substitutable for each other, such that for any
214208
expression `f(x)`, `f(a) === f(b)`.

docs/src/main/mdoc/index.md

+25-45
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,19 @@ code without having to "bake in" particular numeric representations. In most
2424
cases, generic implementations using Spire's specialized type classes perform
2525
identically to corresponding direct implementations.
2626

27-
### Javadocs
28-
29-
|library|link|
30-
|---|---|
31-
|spire| https://www.javadoc.io/doc/org.typelevel/spire_2.13/latest/spire/index.html |
32-
|spire-extras| https://www.javadoc.io/doc/org.typelevel/spire-extras_2.13/latest/spire/index.html |
33-
|spire-laws| https://www.javadoc.io/doc/org.typelevel/spire-laws_2.13/latest/spire/index.html |
34-
|spire-macros| https://www.javadoc.io/doc/org.typelevel/spire-macros_2.13/latest/spire/index.html |
35-
27+
### Scaladoc
28+
[![Core](https://javadoc.io/badge2/org.typelevel/spire_2.13/javadoc.svg)](https://javadoc.io/doc/org.typelevel/spire_2.13)
29+
[![Extras](https://javadoc.io/badge2/org.typelevel/spire-extras_2.13/javadoc.svg)](https://javadoc.io/doc/org.typelevel/spire-extras_2.13)
30+
[![Laws](https://javadoc.io/badge2/org.typelevel/spire-laws_2.13/javadoc.svg)](https://javadoc.io/doc/org.typelevel/spire-laws_2.13)
31+
[![Macros](https://javadoc.io/badge2/org.typelevel/spire-macros_2.13/javadoc.svg)](https://javadoc.io/doc/org.typelevel/spire-macros_2.13)
3632

3733
Spire is provided to you as free software under the
3834
[MIT license](https://github.com/typelevel/spire/blob/main/COPYING).
3935

4036
### Organization
4137

42-
We spire (and typelevel) have [dicord](https://discord.com/invite/XF3CXcMzqD), [gitter chat](https://gitter.im/typelevel/spire) and [mailing list](https://groups.google.com/group/typelevel/).
43-
44-
- [typelevel dicord](https://discord.com/invite/XF3CXcMzqD): community for all typelevel-stack contributers and users.
45-
- [spire gitter](https://gitter.im/typelevel/spire) : place to go for announcements and discussions around Spire.
46-
- [mailng list](https://groups.google.com/group/typelevel/): place to go for announcements and discussions around [Typelevel projects](https://typelevel.org).
47-
48-
38+
There is `#spire` channel on the [Typelevel Discord](https://discord.com/invite/XF3CXcMzqD).
39+
It is the place to go for announcements and discussions around Spire.
4940

5041
We also have a guide on [contributing to Spire](./extra_md/contributing.html) as well
5142
as a guide that provides information on [Spire's guide](./guide.html) and [design notes](./extra_md/design.html).
@@ -58,25 +49,20 @@ merging pull requests, and for helping to guide the direction of Spire:
5849
* Rüdiger Klaehn (*[email protected]*)
5950
* Denis Rosset (*[email protected]*)
6051

61-
#### Code of Conduct
52+
### Code of Conduct
6253

63-
People are expected to follow the [Scala Code of Conduct](https://www.scala-lang.org/conduct/)
64-
when discussing Spire on the Github page, in Gitter, the IRC channel,
54+
People are expected to follow the [Typelevel Code of Conduct](https://typelevel.org/code-of-conduct.html)
55+
when discussing Spire on the Github page, in Discord, Gitter, the IRC channel,
6556
mailing list, and other official venues.
6657

67-
Concerns or issues can be sent to any of Spire's maintainers, or to the
68-
[Typelevel](https://typelevel.org/about.html) organization.
58+
Concerns or issues can be sent to any of Spire's maintainers, or to any of the
59+
[designated CoC contacts](https://typelevel.org/code-of-conduct.html) for Typelevel.
6960

7061
### Set up
7162

72-
Spire is currently available for Scala 2.11, 2.12 and 2.13, for the
63+
Spire is currently available for Scala 2.13 and 3.1+, for the
7364
JVM and JS platforms.
7465

75-
**Since v0.18.0, spire is available for Scala 3!**.
76-
77-
If you have already used spire of older version, check [migration guide](./extra_md/changes.html#version-0180-m1) because there are some breaking changes.
78-
79-
8066
To get started with SBT, simply add the following to your `build.sbt` file:
8167

8268
```
@@ -86,14 +72,8 @@ libraryDependencies += "org.typelevel" %% "spire" % "@VERSION@"
8672
(Previous to 0.14.0, Spire was published under *org.spire-math*
8773
instead of *org.typelevel*.)
8874

89-
For Maven instructions, and to download the jars directly, visit the Central Maven repository.
90-
91-
|Scala version| Maven Repo|
92-
|---|---|
93-
| 2.11.x|https://search.maven.org/artifact/org.typelevel/spire_2.11|
94-
| 2.12.x|https://search.maven.org/artifact/org.typelevel/spire_2.12|
95-
| 2.13.x|https://search.maven.org/artifact/org.typelevel/spire_2.13|
96-
| 3.x|https://search.maven.org/artifact/org.typelevel/spire_3|
75+
For information on all the available versions, visit the
76+
[Scaladex entry](https://index.scala-lang.org/typelevel/spire).
9777

9878
Here is a list of all of Spire's modules:
9979

@@ -108,12 +88,13 @@ and uses this project to interoperate with [Cats](https://github.com/typelevel/c
10888

10989
### Playing Around
11090

111-
If you are new to Scala, or does not have Scala (or sbt) locally, try spire at [scastie](https://scastie.scala-lang.org/LVRAHaJAS7qoVbUyoDgKNA) on browser.
91+
The quickest way to try spire is in the browser with [Scastie](https://scastie.scala-lang.org/LVRAHaJAS7qoVbUyoDgKNA).
11292

11393
<script src="https://scastie.scala-lang.org/LVRAHaJAS7qoVbUyoDgKNA.js"></script>
11494

11595
#### With Ammonite Repl
116-
If you have [ammonite](https://ammonite.io/), enter `amm` in your terminal to launch ammonite REPL.
96+
97+
If you have [ammonite](https://ammonite.io/), you can use an interactive REPL session.
11798

11899
```scala
119100
Welcome to the Ammonite Repl 2.x.x
@@ -125,13 +106,11 @@ Welcome to the Ammonite Repl 2.x.x
125106
res: Complex[Double] = Complex(real = 10.472508533940392, imag = -73.46062169567367)
126107
```
127108

109+
#### With an IDE
128110

129-
#### with `*.worksheet.sc`
130-
You can also play around with IntelliJ or VS Code & Metals.
131-
132-
For example, create `spire.worksheet.sc` and copy-paste the following code snippet.
111+
You can also play around with [IntelliJ](https://www.jetbrains.com/help/idea/discover-intellij-idea-for-scala.html) or [VS Code and Metals](https://scalameta.org/metals/docs/editors/vscode/).
133112

134-
Then, open `spire.worksheet.sc` with IntelliJ or CS Code (needs [metals VS Code extension](https://scalameta.org/metals/docs/editors/vscode/)).
113+
Create a [worksheet](https://scalameta.org/metals/docs/editors/vscode/#worksheets) file `spire.worksheet.sc` in your IDE and copy-paste the following code snippet.
135114

136115
```scala
137116
import $ivy.`org.typelevel::spire:@VERSION@`
@@ -141,7 +120,8 @@ import spire.implicits._
141120
Complex(3.0,5.0).sin
142121
res: Complex[Double] = Complex(real = 10.472508533940392, imag = -73.46062169567367)
143122
```
144-
#### with git and sbt
123+
124+
#### With git and sbt
145125
If you clone the Spire repo, you can get a taste of what Spire can do using
146126
SBT's console. Launch `sbt` and at the prompt, type `coreJVM/console`:
147127

@@ -451,7 +431,7 @@ object SIDemo {
451431
}
452432
```
453433

454-
Spire also provides a loop macro called `cfor`(renamed to `fastFor` in v0.18.0) whose syntax bears a slight
434+
Spire also provides a loop macro called `fastFor` (previously known as `cfor`) whose syntax bears a slight
455435
resemblance to a traditional for-loop from C or Java. This macro expands to a
456436
tail-recursive function, which will inline literal function arguments.
457437

@@ -622,7 +602,7 @@ measure relative as well as absolute performance.
622602
Code is offered as-is, with no implied warranty of any kind. Comments,
623603
criticisms, and/or praise are welcome, especially from numerical analysts! ;)
624604

625-
Copyright 2011-@COPYRIGHT_TO@ @AUTHORS@
605+
Copyright 2011-2017 Erik Osheim, Tom Switzer
626606

627607
A full list of contributors can be found in [AUTHORS.md](./extra_md/authors.html).
628608

0 commit comments

Comments
 (0)