Skip to content

Use EmptyTuple instead of Unit in typeclass derivation docs #9431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/docs/reference/contextual/derivation-macro.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ have the given instances for our primitive types:
case '[String *: $tpes] => '{ summon[Eq[String]] } :: summonAll(tpes)
case '[Int *: $tpes] => '{ summon[Eq[Int]] } :: summonAll(tpes)
case '[$tpe *: $tpes] => derived(using tpe, qctx) :: summonAll(tpes)
case '[Unit] => Nil
case '[EmptyTuple] => Nil
}
```

Expand Down Expand Up @@ -173,7 +173,7 @@ object Eq {
case '[String *: $tpes] => '{ summon[Eq[String]] } :: summonAll(tpes)
case '[Int *: $tpes] => '{ summon[Eq[Int]] } :: summonAll(tpes)
case '[$tpe *: $tpes] => derived(using tpe, qctx) :: summonAll(tpes)
case '[Unit] => Nil
case '[EmptyTuple] => Nil
}

given derived[T: Type](using qctx: QuoteContext) as Expr[Eq[T]] = {
Expand Down Expand Up @@ -222,4 +222,4 @@ object Macro3 {

implicit inline def eqGen[T]: Eq[T] = ${ Eq.derived[T] }
}
```
```
4 changes: 2 additions & 2 deletions docs/docs/reference/contextual/derivation.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ implementation of `summonAll` is `inline` and uses Dotty's `summonInline` constr
```scala

inline def summonAll[T <: Tuple]: List[Eq[_]] = inline erasedValue[T] match {
case _: Unit => Nil
case _: EmptyTuple => Nil
case _: (t *: ts) => summonInline[Eq[t]] :: summonAll[ts]
}
```
Expand Down Expand Up @@ -244,7 +244,7 @@ import scala.deriving._
import scala.compiletime.{erasedValue, summonInline}

inline def summonAll[T <: Tuple]: List[Eq[_]] = inline erasedValue[T] match {
case _: Unit => Nil
case _: EmptyTuple => Nil
case _: (t *: ts) => summonInline[Eq[t]] :: summonAll[ts]
}

Expand Down