Skip to content

Commit 54c1555

Browse files
committed
apply the docstring formatting
1 parent 924d170 commit 54c1555

205 files changed

Lines changed: 1907 additions & 2349 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

algebra-core/src/main/scala/algebra/Priority.scala

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,11 @@ import scala.annotation.nowarn
2626
/**
2727
* Priority is a type class for prioritized implicit search.
2828
*
29-
* This type class will attempt to provide an implicit instance of `P`
30-
* (the preferred type). If that type is not available it will
31-
* fallback to `F` (the fallback type). If neither type is available
32-
* then a `Priority[P, F]` instance will not be available.
29+
* This type class will attempt to provide an implicit instance of `P` (the preferred type). If that type is not
30+
* available it will fallback to `F` (the fallback type). If neither type is available then a `Priority[P, F]` instance
31+
* will not be available.
3332
*
34-
* This type can be useful for problems where multiple algorithms can
35-
* be used, depending on the type classes available.
33+
* This type can be useful for problems where multiple algorithms can be used, depending on the type classes available.
3634
*/
3735
sealed trait Priority[+P, +F] {
3836

algebra-core/src/main/scala/algebra/instances/StaticMethods.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ object StaticMethods {
2828
/**
2929
* Exponentiation function, e.g. x^y
3030
*
31-
* If base^ex doesn't fit in a Long, the result will overflow (unlike
32-
* Math.pow which will return +/- Infinity).
31+
* If base^ex doesn't fit in a Long, the result will overflow (unlike Math.pow which will return +/- Infinity).
3332
*/
3433
final def pow(base: Long, exponent: Long): Long = {
3534
@tailrec def loop(t: Long, b: Long, e: Long): Long =

algebra-core/src/main/scala/algebra/instances/double.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,11 @@ trait DoubleInstances extends cats.kernel.instances.DoubleInstances {
3737
}
3838

3939
/**
40-
* Due to the way floating-point equality works, this instance is not
41-
* lawful under equality, but is correct when taken as an
42-
* approximation of an exact value.
40+
* Due to the way floating-point equality works, this instance is not lawful under equality, but is correct when taken
41+
* as an approximation of an exact value.
4342
*
44-
* If you would prefer an absolutely lawful fractional value, you'll
45-
* need to investigate rational numbers or more exotic types.
43+
* If you would prefer an absolutely lawful fractional value, you'll need to investigate rational numbers or more exotic
44+
* types.
4645
*/
4746
class DoubleAlgebra extends Field[Double] with Serializable {
4847

algebra-core/src/main/scala/algebra/instances/float.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,11 @@ trait FloatInstances extends cats.kernel.instances.FloatInstances {
3636
}
3737

3838
/**
39-
* Due to the way floating-point equality works, this instance is not
40-
* lawful under equality, but is correct when taken as an
41-
* approximation of an exact value.
39+
* Due to the way floating-point equality works, this instance is not lawful under equality, but is correct when taken
40+
* as an approximation of an exact value.
4241
*
43-
* If you would prefer an absolutely lawful fractional value, you'll
44-
* need to investigate rational numbers or more exotic types.
42+
* If you would prefer an absolutely lawful fractional value, you'll need to investigate rational numbers or more exotic
43+
* types.
4544
*/
4645
class FloatAlgebra extends Field[Float] with Serializable {
4746

algebra-core/src/main/scala/algebra/lattice/Bool.scala

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,18 @@ import ring.BoolRing
2626
import scala.{specialized => sp}
2727

2828
/**
29-
* Boolean algebras are Heyting algebras with the additional
30-
* constraint that the law of the excluded middle is true
29+
* Boolean algebras are Heyting algebras with the additional constraint that the law of the excluded middle is true
3130
* (equivalently, double-negation is true).
3231
*
33-
* This means that in addition to the laws Heyting algebras obey,
34-
* boolean algebras also obey the following:
32+
* This means that in addition to the laws Heyting algebras obey, boolean algebras also obey the following:
3533
*
36-
* - (a ∨ ¬a) = 1
37-
* - ¬¬a = a
34+
* - (a ∨ ¬a) = 1
35+
* - ¬¬a = a
3836
*
39-
* Boolean algebras generalize classical logic: one is equivalent to
40-
* "true" and zero is equivalent to "false". Boolean algebras provide
41-
* additional logical operators such as `xor`, `nand`, `nor`, and
42-
* `nxor` which are commonly used.
37+
* Boolean algebras generalize classical logic: one is equivalent to "true" and zero is equivalent to "false". Boolean
38+
* algebras provide additional logical operators such as `xor`, `nand`, `nor`, and `nxor` which are commonly used.
4339
*
44-
* Every boolean algebras has a dual algebra, which involves reversing
45-
* true/false as well as and/or.
40+
* Every boolean algebras has a dual algebra, which involves reversing true/false as well as and/or.
4641
*/
4742
trait Bool[@sp(Int, Long) A] extends Any with Heyting[A] with GenBool[A] { self =>
4843
def imp(a: A, b: A): A = or(complement(a), b)
@@ -56,13 +51,12 @@ trait Bool[@sp(Int, Long) A] extends Any with Heyting[A] with GenBool[A] { self
5651
override def dual: Bool[A] = new DualBool(this)
5752

5853
/**
59-
* Every Boolean algebra is a BoolRing, with multiplication defined as
60-
* `and` and addition defined as `xor`. Bool does not extend BoolRing
61-
* because, e.g. we might want a Bool[Int] and CommutativeRing[Int] to
62-
* refer to different structures, by default.
54+
* Every Boolean algebra is a BoolRing, with multiplication defined as `and` and addition defined as `xor`. Bool does
55+
* not extend BoolRing because, e.g. we might want a Bool[Int] and CommutativeRing[Int] to refer to different
56+
* structures, by default.
6357
*
64-
* Note that the ring returned by this method is not an extension of
65-
* the `Rig` returned from `BoundedDistributiveLattice.asCommutativeRig`.
58+
* Note that the ring returned by this method is not an extension of the `Rig` returned from
59+
* `BoundedDistributiveLattice.asCommutativeRig`.
6660
*/
6761
override def asBoolRing: BoolRing[A] = new BoolRingFromBool(self)
6862
}
@@ -89,11 +83,11 @@ class BoolRingFromBool[A](orig: Bool[A]) extends BoolRngFromGenBool(orig) with B
8983

9084
/**
9185
* Every Boolean ring gives rise to a Boolean algebra:
92-
* - 0 and 1 are preserved;
93-
* - ring multiplication (`times`) corresponds to `and`;
94-
* - ring addition (`plus`) corresponds to `xor`;
95-
* - `a or b` is then defined as `a xor b xor (a and b)`;
96-
* - complement (`¬a`) is defined as `a xor 1`.
86+
* - 0 and 1 are preserved;
87+
* - ring multiplication (`times`) corresponds to `and`;
88+
* - ring addition (`plus`) corresponds to `xor`;
89+
* - `a or b` is then defined as `a xor b xor (a and b)`;
90+
* - complement (`¬a`) is defined as `a xor 1`.
9791
*/
9892
class BoolFromBoolRing[A](orig: BoolRing[A]) extends GenBoolFromBoolRng(orig) with Bool[A] {
9993
def one: A = orig.one

algebra-core/src/main/scala/algebra/lattice/BoundedDistributiveLattice.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ trait BoundedDistributiveLattice[@sp(Int, Long, Float, Double) A]
3434
with DistributiveLattice[A] { self =>
3535

3636
/**
37-
* Return a CommutativeRig using join and meet. Note this must obey the commutative rig laws since
38-
* meet(a, one) = a, and meet and join are associative, commutative and distributive.
37+
* Return a CommutativeRig using join and meet. Note this must obey the commutative rig laws since meet(a, one) = a,
38+
* and meet and join are associative, commutative and distributive.
3939
*/
4040
private[algebra] def asCommutativeRig: CommutativeRig[A] =
4141
new CommutativeRig[A] {

algebra-core/src/main/scala/algebra/lattice/BoundedLattice.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,16 @@ package lattice
2525
import scala.{specialized => sp}
2626

2727
/**
28-
* A bounded lattice is a lattice that additionally has one element
29-
* that is the bottom (zero, also written as ⊥), and one element that
30-
* is the top (one, also written as ⊤).
28+
* A bounded lattice is a lattice that additionally has one element that is the bottom (zero, also written as ⊥), and
29+
* one element that is the top (one, also written as ⊤).
3130
*
3231
* This means that for any a in A:
3332
*
34-
* join(zero, a) = a = meet(one, a)
33+
* join(zero, a) = a = meet(one, a)
3534
*
3635
* Or written using traditional notation:
3736
*
38-
* (0 ∨ a) = a = (1 ∧ a)
37+
* (0 ∨ a) = a = (1 ∧ a)
3938
*/
4039
trait BoundedLattice[@sp(Int, Long, Float, Double) A]
4140
extends Any

algebra-core/src/main/scala/algebra/lattice/DeMorgan.scala

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,19 @@ package lattice
2525
import scala.{specialized => sp}
2626

2727
/**
28-
* De Morgan algebras are bounded lattices that are also equipped with
29-
* a De Morgan involution.
28+
* De Morgan algebras are bounded lattices that are also equipped with a De Morgan involution.
3029
*
3130
* De Morgan involution obeys the following laws:
3231
*
33-
* - ¬¬a = a
34-
* - ¬(x∧y) = ¬x∨¬y
32+
* - ¬¬a = a
33+
* - ¬(x∧y) = ¬x∨¬y
3534
*
36-
* However, in De Morgan algebras this involution does not necessarily
37-
* provide the law of the excluded middle. This means that there is no
38-
* guarantee that (a ∨ ¬a) = 1. De Morgan algebra do not not necessarily
39-
* provide the law of non contradiction either. This means that there is
40-
* no guarantee that (a ∧ ¬a) = 0.
35+
* However, in De Morgan algebras this involution does not necessarily provide the law of the excluded middle. This
36+
* means that there is no guarantee that (a ∨ ¬a) = 1. De Morgan algebra do not not necessarily provide the law of non
37+
* contradiction either. This means that there is no guarantee that (a ∧ ¬a) = 0.
4138
*
42-
* De Morgan algebras are useful to model fuzzy logic. For a model of
43-
* classical logic, see the boolean algebra type class implemented as
44-
* [[Bool]].
39+
* De Morgan algebras are useful to model fuzzy logic. For a model of classical logic, see the boolean algebra type
40+
* class implemented as [[Bool]].
4541
*/
4642
trait DeMorgan[@sp(Int, Long) A] extends Any with Logic[A] { self =>
4743
def meet(a: A, b: A): A = and(a, b)
@@ -64,8 +60,7 @@ object DeMorgan extends DeMorganFunctions[DeMorgan] {
6460
@inline final def apply[@sp(Int, Long) A](implicit ev: DeMorgan[A]): DeMorgan[A] = ev
6561

6662
/**
67-
* Turn a [[Bool]] into a `DeMorgan`
68-
* Used for binary compatibility.
63+
* Turn a [[Bool]] into a `DeMorgan` Used for binary compatibility.
6964
*/
7065
final def fromBool[@sp(Int, Long) A](bool: Bool[A]): DeMorgan[A] =
7166
new DeMorgan[A] {

algebra-core/src/main/scala/algebra/lattice/GenBool.scala

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ import ring.BoolRng
2626
import scala.{specialized => sp}
2727

2828
/**
29-
* Generalized Boolean algebra, that is, a Boolean algebra without
30-
* the top element. Generalized Boolean algebras do not (in general)
31-
* have (absolute) complements, but they have ''relative complements''
32-
* (see [[GenBool.without]]).
29+
* Generalized Boolean algebra, that is, a Boolean algebra without the top element. Generalized Boolean algebras do not
30+
* (in general) have (absolute) complements, but they have ''relative complements'' (see [[GenBool.without]]).
3331
*/
3432
trait GenBool[@sp(Int, Long) A] extends Any with DistributiveLattice[A] with BoundedJoinSemilattice[A] { self =>
3533
def and(a: A, b: A): A
@@ -39,37 +37,36 @@ trait GenBool[@sp(Int, Long) A] extends Any with DistributiveLattice[A] with Bou
3937
override def join(a: A, b: A): A = or(a, b)
4038

4139
/**
42-
* The operation of ''relative complement'', symbolically often denoted
43-
* `a\b` (the symbol for set-theoretic difference, which is the
44-
* meaning of relative complement in the lattice of sets).
40+
* The operation of ''relative complement'', symbolically often denoted `a\b` (the symbol for set-theoretic
41+
* difference, which is the meaning of relative complement in the lattice of sets).
4542
*/
4643
def without(a: A, b: A): A
4744

4845
/**
49-
* Logical exclusive or, set-theoretic symmetric difference.
50-
* Defined as `a\b ∨ b\a`.
46+
* Logical exclusive or, set-theoretic symmetric difference. Defined as `a\b ∨ b\a`.
5147
*/
5248
def xor(a: A, b: A): A = or(without(a, b), without(b, a))
5349

5450
/**
55-
* Every generalized Boolean algebra is also a `BoolRng`, with
56-
* multiplication defined as `and` and addition defined as `xor`.
51+
* Every generalized Boolean algebra is also a `BoolRng`, with multiplication defined as `and` and addition defined as
52+
* `xor`.
5753
*/
5854
@deprecated("See typelevel/algebra#108 for discussion", since = "2.7.0")
5955
def asBoolRing: BoolRng[A] = new BoolRngFromGenBool(self)
6056
}
6157

6258
/**
6359
* Every Boolean rng gives rise to a Boolean algebra without top:
64-
* - 0 is preserved;
65-
* - ring multiplication (`times`) corresponds to `and`;
66-
* - ring addition (`plus`) corresponds to `xor`;
67-
* - `a or b` is then defined as `a xor b xor (a and b)`;
68-
* - relative complement `a\b` is defined as `a xor (a and b)`.
60+
* - 0 is preserved;
61+
* - ring multiplication (`times`) corresponds to `and`;
62+
* - ring addition (`plus`) corresponds to `xor`;
63+
* - `a or b` is then defined as `a xor b xor (a and b)`;
64+
* - relative complement `a\b` is defined as `a xor (a and b)`.
6965
*
7066
* `BoolRng.asBool.asBoolRing` gives back the original `BoolRng`.
7167
*
72-
* @see [[algebra.lattice.GenBool.asBoolRing]]
68+
* @see
69+
* [[algebra.lattice.GenBool.asBoolRing]]
7370
*/
7471
class GenBoolFromBoolRng[A](orig: BoolRng[A]) extends GenBool[A] {
7572
def zero: A = orig.zero

algebra-core/src/main/scala/algebra/lattice/Heyting.scala

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,28 @@ package lattice
2525
import scala.{specialized => sp}
2626

2727
/**
28-
* Heyting algebras are bounded lattices that are also equipped with
29-
* an additional binary operation `imp` (for implication, also
30-
* written as →).
28+
* Heyting algebras are bounded lattices that are also equipped with an additional binary operation `imp` (for
29+
* implication, also written as →).
3130
*
3231
* Implication obeys the following laws:
3332
*
34-
* - a → a = 1
35-
* - a ∧ (a → b) = a ∧ b
36-
* - b ∧ (a → b) = b
37-
* - a → (b ∧ c) = (a → b) ∧ (a → c)
33+
* - a → a = 1
34+
* - a ∧ (a → b) = a ∧ b
35+
* - b ∧ (a → b) = b
36+
* - a → (b ∧ c) = (a → b) ∧ (a → c)
3837
*
39-
* In heyting algebras, `and` is equivalent to `meet` and `or` is
40-
* equivalent to `join`; both methods are available.
38+
* In heyting algebras, `and` is equivalent to `meet` and `or` is equivalent to `join`; both methods are available.
4139
*
42-
* Heyting algebra also define `complement` operation (sometimes
43-
* written as ¬a). The complement of `a` is equivalent to `(a → 0)`,
44-
* and the following laws hold:
40+
* Heyting algebra also define `complement` operation (sometimes written as ¬a). The complement of `a` is equivalent to
41+
* `(a → 0)`, and the following laws hold:
4542
*
46-
* - a ∧ ¬a = 0
43+
* - a ∧ ¬a = 0
4744
*
48-
* However, in Heyting algebras this operation is only a
49-
* pseudo-complement, since Heyting algebras do not necessarily
50-
* provide the law of the excluded middle. This means that there is no
51-
* guarantee that (a ∨ ¬a) = 1.
45+
* However, in Heyting algebras this operation is only a pseudo-complement, since Heyting algebras do not necessarily
46+
* provide the law of the excluded middle. This means that there is no guarantee that (a ∨ ¬a) = 1.
5247
*
53-
* Heyting algebras model intuitionistic logic. For a model of
54-
* classical logic, see the boolean algebra type class implemented as
55-
* `Bool`.
48+
* Heyting algebras model intuitionistic logic. For a model of classical logic, see the boolean algebra type class
49+
* implemented as `Bool`.
5650
*/
5751
trait Heyting[@sp(Int, Long) A] extends Any with BoundedDistributiveLattice[A] { self =>
5852
def and(a: A, b: A): A

0 commit comments

Comments
 (0)