Skip to content

Commit fbd6359

Browse files
committed
Fix typos
1 parent b356d75 commit fbd6359

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

docs/docs/reference/derivation.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ This is all a user of typeclass derivation has to know. The rest of this page co
5757

5858
For every class with a `derives` clause, the compiler computes the shape of that class as a type. For instance, here is the shape type for the `Tree[T]` enum:
5959
```scala
60-
Cases[
60+
Cases[(
6161
Case[Branch[T], (Tree[T], Tree[T])],
6262
Case[Leaf[T], T *: Unit]
63-
]
63+
)]
6464
```
6565
Informally, this states that
6666

@@ -88,10 +88,10 @@ Case[Labelled[T], (T, String)]
8888
```
8989
And here is the one for `Option[T]`:
9090
```scala
91-
Cases[
91+
Cases[(
9292
Case[Some[T], T *: Unit],
9393
Case[None.type, Unit]
94-
]
94+
)]
9595
```
9696
Note that an empty element tuple is represented as type `Unit`. A single-element tuple
9797
is represented as `T *: Unit` since there is no direct syntax for such tuples: `(T)` is just `T` in parentheses, not a tuple.
@@ -225,7 +225,7 @@ trait Eq[T] {
225225
We need to implement a method `Eq.derived` that produces an instance of `Eq[T]` provided
226226
there exists evidence of type `Generic[T]`. Here's a possible solution:
227227
```scala
228-
inline def derived[T, S <: Shape](implicit ev: Generic[T]): Eq[T] = new Eq[T] {
228+
inline def derived[T](implicit ev: Generic[T]): Eq[T] = new Eq[T] {
229229
def eql(x: T, y: T): Boolean = {
230230
val mx = ev.reflect(x) // (1)
231231
val my = ev.reflect(y) // (2)
@@ -322,9 +322,9 @@ calling the `error` method defined in `scala.compiletime`.
322322
**Example:** Here is a slightly polished and compacted version of the code that's generated by inline expansion for the derived `Eq` instance of class `Tree`.
323323

324324
```scala
325-
implicit def derived$Eq[T](implicit elemEq: Eq[T]): Eq[T] = new Eq[Tree[T]] {
325+
implicit def derived$Eq[T](implicit elemEq: Eq[T]): Eq[Tree[T]] = new Eq[Tree[T]] {
326326
def eql(x: Tree[T], y: Tree[T]): Boolean = {
327-
val ev = implOf[Generic[Tree[T]]]
327+
val ev = implicitly[Generic[Tree[T]]]
328328
val mx = ev.reflect(x)
329329
val my = ev.reflect(y)
330330
mx.ordinal == my.ordinal && {

0 commit comments

Comments
 (0)