Skip to content

Commit 3f8131f

Browse files
committed
Update docs
1 parent d47e6ca commit 3f8131f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/docs/reference/contextual/derivation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,15 @@ object Eq {
262262

263263
def iterator[T](p: T) = p.asInstanceOf[Product].productIterator
264264

265-
def eqSum[T](s: Mirror.SumOf[T], elems: List[Eq[_]]): Eq[T] =
265+
def eqSum[T](s: Mirror.SumOf[T], elems: => List[Eq[_]]): Eq[T] =
266266
new Eq[T] {
267267
def eqv(x: T, y: T): Boolean = {
268268
val ordx = s.ordinal(x)
269269
(s.ordinal(y) == ordx) && check(elems(ordx))(x, y)
270270
}
271271
}
272272

273-
def eqProduct[T](p: Mirror.ProductOf[T], elems: List[Eq[_]]): Eq[T] =
273+
def eqProduct[T](p: Mirror.ProductOf[T], elems: => List[Eq[_]]): Eq[T] =
274274
new Eq[T] {
275275
def eqv(x: T, y: T): Boolean =
276276
iterator(x).zip(iterator(y)).zip(elems.iterator).forall {
@@ -279,7 +279,7 @@ object Eq {
279279
}
280280

281281
inline given derived[T](using m: Mirror.Of[T]) as Eq[T] = {
282-
val elemInstances = summonAll[m.MirroredElemTypes]
282+
lazy val elemInstances = summonAll[m.MirroredElemTypes]
283283
inline m match {
284284
case s: Mirror.SumOf[T] => eqSum(s, elemInstances)
285285
case p: Mirror.ProductOf[T] => eqProduct(p, elemInstances)

0 commit comments

Comments
 (0)