Skip to content

Commit 57b75d4

Browse files
committed
Polishings
1 parent f21ab57 commit 57b75d4

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

docs/docs/reference/derivation.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ implicit def derived$Ordering [T: Ordering]: Ordering[Tree[T]] = Ordering.derive
1717
implicit def derived$Pickling [T: Pickling]: Pickling[Tree[T]] = Pickling.derived
1818
```
1919

20-
**Note**: This page uses the new syntax proposed for implicits that is explored in #5448. This is not yet an endorsement of that syntax, but rather a way to experiment with it.
21-
2220
### Deriving Types
2321

2422
Besides for `enums`, typeclasses can also be derived for other sets of classes and objects that form an algebraic data type. These are:
@@ -324,7 +322,7 @@ calling the `error` method defined in `scala.compiletime`.
324322
**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`.
325323

326324
```scala
327-
implicit def Eq_Tree_impl[T](implicit elemEq: Eq[T]): Eq[T] = new Eq[Tree[T]] {
325+
implicit def derived$Eq[T](implicit elemEq: Eq[T]): Eq[T] = new Eq[Tree[T]] {
328326
def eql(x: Tree[T], y: Tree[T]): Boolean = {
329327
val ev = implOf[Generic[Tree[T]]]
330328
val mx = ev.reflect(x)
@@ -350,7 +348,7 @@ One important difference between this approach and Scala-2 typeclass derivation
350348
Sometimes one would like to derive a typeclass instance for an ADT after the ADT is defined, without being able to change the code of the ADT itself.
351349
To do this, simply define an instance with the `derived` method of the typeclass as right hand side. E.g, to implement `Ordering` for `Option`, define:
352350
```scala
353-
implicit def derived$Ordering[T: Ordering]: Ordering[Option[T]] = Ordering.derived
351+
implicit def myOptionOrdering[T: Ordering]: Ordering[Option[T]] = Ordering.derived
354352
```
355353
Usually, the `Ordering.derived` clause has an implicit parameter of type
356354
`Generic[Option[T]]`. Since the `Option` trait has a `derives` clause,

0 commit comments

Comments
 (0)