Skip to content

Commit d313860

Browse files
committed
doc(multiversal-eql): improve formatting
1 parent f28509d commit d313860

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

docs/docs/reference/contextual/multiversal-equality.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,19 @@ given Eql[B, A] = Eql.derived
6767
The `scala.Eql` object defines a number of `Eql` given instances that together
6868
define a rule book for what standard types can be compared (more details below).
6969

70-
There's also a "fallback" instance named `eqlAny` that allows comparisons
70+
There is also a "fallback" instance named `eqlAny` that allows comparisons
7171
over all types that do not themselves have an `Eql` given. `eqlAny` is defined as follows:
7272

7373
```scala
7474
def eqlAny[L, R]: Eql[L, R] = Eql.derived
7575
```
7676

77-
Even though `eqlAny` is not declared a given, the compiler will still construct an `eqlAny` instance as answer to an implicit search for the
77+
Even though `eqlAny` is not declared as `given`, the compiler will still construct an `eqlAny` instance as answer to an implicit search for the
7878
type `Eql[L, R]`, unless `L` or `R` have `Eql` instances
79-
defined on them, or the language feature `strictEquality` is enabled
79+
defined on them, or the language feature `strictEquality` is enabled.
8080

81-
The primary motivation for having `eqlAny` is backwards compatibility,
82-
if this is of no concern, one can disable `eqlAny` by enabling the language
81+
The primary motivation for having `eqlAny` is backwards compatibility.
82+
If this is of no concern, one can disable `eqlAny` by enabling the language
8383
feature `strictEquality`. As for all language features this can be either
8484
done with an import
8585

@@ -112,7 +112,7 @@ The precise rules for equality checking are as follows.
112112

113113
If the `strictEquality` feature is enabled then
114114
a comparison using `x == y` or `x != y` between values `x: T` and `y: U`
115-
is legal if there is a given of type `Eql[T, U]`.
115+
is legal if there is a `given` of type `Eql[T, U]`.
116116

117117
In the default case where the `strictEquality` feature is not enabled the comparison is
118118
also legal if
@@ -123,8 +123,8 @@ also legal if
123123

124124
Explanations:
125125

126-
- _lifting_ a type `S` means replacing all references to abstract types
127-
in covariant positions of `S` by their upper bound, and to replacing
126+
- _lifting_ a type `S` means replacing all references to abstract types
127+
in covariant positions of `S` by their upper bound, and replacing
128128
all refinement types in covariant positions of `S` by their parent.
129129
- a type `T` has a _reflexive_ `Eql` instance if the implicit search for `Eql[T, T]`
130130
succeeds.
@@ -153,8 +153,9 @@ Instances are defined so that every one of these types has a _reflexive_ `Eql` i
153153
## Why Two Type Parameters?
154154

155155
One particular feature of the `Eql` type is that it takes _two_ type parameters, representing the types of the two items to be compared. By contrast, conventional
156-
implementations of an equality type class take only a single type parameter which represents the common type of _both_ operands. One type parameter is simpler than two, so why go through the additional complication? The reason has to do with the fact that, rather than coming up with a type class where no operation existed before,
157-
we are dealing with a refinement of pre-existing, universal equality. It's best illustrated through an example.
156+
implementations of an equality type class take only a single type parameter which represents the common type of _both_ operands.
157+
One type parameter is simpler than two, so why go through the additional complication? The reason has to do with the fact that, rather than coming up with a type class where no operation existed before,
158+
we are dealing with a refinement of pre-existing, universal equality. It is best illustrated through an example.
158159

159160
Say you want to come up with a safe version of the `contains` method on `List[T]`. The original definition of `contains` in the standard library was:
160161
```scala

0 commit comments

Comments
 (0)