Skip to content

Commit e7ea53b

Browse files
authored
Merge pull request #8 from joroKr21/eagerness
Use eager parameters when by-name is not necessary
2 parents 307a5ec + 40b20c1 commit e7ea53b

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

modules/deriving/src/test/scala/shapeless3/deriving/type-classes.scala

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ object Eq {
8787
[t] => (acc: Boolean, eqt: Eq[t], t0: t, t1: t) => Complete(!eqt.eqv(t0, t1))(false)(true)
8888
)
8989

90-
given eqGenC[A](using inst: => K0.CoproductInstances[Eq, A]): Eq[A] with
90+
given eqGenC[A](using inst: K0.CoproductInstances[Eq, A]): Eq[A] with
9191
def eqv(x: A, y: A): Boolean = inst.fold2(x, y)(false)(
9292
[t] => (eqt: Eq[t], t0: t, t1: t) => eqt.eqv(t0, t1)
9393
)
@@ -126,15 +126,15 @@ object Ord {
126126

127127
def compare(x: String, y: String): Int = x.compare(y)
128128

129-
given ordGen[A](using inst: => K0.ProductInstances[Ord, A]): Ord[A] with
129+
given ordGen[A](using inst: K0.ProductInstances[Ord, A]): Ord[A] with
130130
def compare(x: A, y: A): Int = inst.foldLeft2(x, y)(0: Int)(
131131
[t] => (acc: Int, ord: Ord[t], t0: t, t1: t) => {
132132
val cmp = ord.compare(t0, t1)
133133
Complete(cmp != 0)(cmp)(acc)
134134
}
135135
)
136136

137-
given ordGenC[A](using inst: => K0.CoproductInstances[Ord, A]): Ord[A] with
137+
given ordGenC[A](using inst: K0.CoproductInstances[Ord, A]): Ord[A] with
138138
def compare(x: A, y: A): Int = inst.fold2(x, y)((x: Int, y: Int) => x - y)(
139139
[t] => (ord: Ord[t], t0: t, t1: t) => ord.compare(t0, t1)
140140
)
@@ -156,7 +156,7 @@ object Functor {
156156
given [F[_], G[_]](using ff: Functor[F], fg: Functor[G]): Functor[[t] =>> F[G[t]]] with
157157
def map[A, B](fga: F[G[A]])(f: A => B): F[G[B]] = ff.map(fga)(ga => fg.map(ga)(f))
158158

159-
given functorGen[F[_]](using inst: => K1.Instances[Functor, F]): Functor[F] with
159+
given functorGen[F[_]](using inst: K1.Instances[Functor, F]): Functor[F] with
160160
def map[A, B](fa: F[A])(f: A => B): F[B] = inst.map(fa)([t[_]] => (ft: Functor[t], ta: t[A]) => ft.map(ta)(f))
161161

162162
given [T]: Functor[Const[T]] with
@@ -235,7 +235,7 @@ object Traverse {
235235
def traverse[G[_], A, B](fa: Const[X][A])(f: A => G[B])(using G: Applicative[G]): G[Const[X][B]] =
236236
G.pure(fa)
237237

238-
given traverseGen[F[_]](using inst: => K1.Instances[Traverse, F], func: K1.Instances[Functor, F]): Traverse[F] with
238+
given traverseGen[F[_]](using inst: K1.Instances[Traverse, F], func: K1.Instances[Functor, F]): Traverse[F] with
239239
import Functor.functorGen as delegate
240240

241241
def map[A, B](fa: F[A])(f: A => B): F[B] = delegate[F].map(fa)(f)
@@ -268,7 +268,7 @@ object Foldable {
268268

269269
def foldRight[A, B](fa: Const[X][A])(lb: Eval[B])(f: (A, Eval[B]) => Eval[B]): Eval[B] = lb
270270

271-
given foldableProduct[F[_]](using inst: => K1.ProductInstances[Foldable, F]): Foldable[F] with
271+
given foldableProduct[F[_]](using inst: K1.ProductInstances[Foldable, F]): Foldable[F] with
272272
def foldLeft[A, B](fa: F[A])(b: B)(f: (B, A) => B): B =
273273
inst.foldLeft[A, B](fa)(b)(
274274
[t[_]] => (acc: B, fd: Foldable[t], t0: t[A]) => Continue(fd.foldLeft(t0)(acc)(f))
@@ -280,7 +280,7 @@ object Foldable {
280280
Continue(Eval.defer(fd.foldRight(t0)(acc)(f)))
281281
)
282282

283-
given foldableCoproduct[F[_]](using inst: => K1.CoproductInstances[Foldable, F]): Foldable[F] with
283+
given foldableCoproduct[F[_]](using inst: K1.CoproductInstances[Foldable, F]): Foldable[F] with
284284
def foldLeft[A, B](fa: F[A])(b: B)(f: (B, A) => B): B =
285285
inst.fold[A, B](fa)(
286286
[t[_]] => (fd: Foldable[t], t0: t[A]) => fd.foldLeft(t0)(b)(f)
@@ -306,7 +306,7 @@ object FunctorK {
306306
given [T]: FunctorK[K11.Id[T]] with
307307
def mapK[A[_], B[_]](at: A[T])(f: A ~> B): B[T] = f(at)
308308

309-
given functorKGen[H[_[_]]](using inst: => K11.Instances[FunctorK, H]): FunctorK[H] with
309+
given functorKGen[H[_[_]]](using inst: K11.Instances[FunctorK, H]): FunctorK[H] with
310310
def mapK[A[_], B[_]](ha: H[A])(f: A ~> B): H[B] =
311311
inst.map(ha)([t[_[_]]] => (ft: FunctorK[t], ta: t[A]) => ft.mapK(ta)(f))
312312

@@ -340,7 +340,7 @@ object Bifunctor {
340340
case Right(b) => Right(g(b))
341341
}
342342

343-
given bifunctorGen[F[_, _]](using inst: => K2.Instances[Bifunctor, F]): Bifunctor[F] with
343+
given bifunctorGen[F[_, _]](using inst: K2.Instances[Bifunctor, F]): Bifunctor[F] with
344344
def bimap[A, B, C, D](fab: F[A, B])(f: A => C, g: B => D): F[C, D] =
345345
inst.map(fab)([t[_, _]] => (bft: Bifunctor[t], tab: t[A, B]) => bft.bimap(tab)(f, g))
346346

@@ -548,7 +548,7 @@ object Show {
548548
).mkString(s"${labelling.label}(", ", ", ")")
549549
}
550550

551-
given showGenC[T](using inst: => K0.CoproductInstances[Show, T]): Show[T] with {
551+
given showGenC[T](using inst: K0.CoproductInstances[Show, T]): Show[T] with {
552552
def show(t: T): String = inst.fold(t)([t] => (st: Show[t], t: t) => st.show(t))
553553
}
554554

@@ -631,7 +631,7 @@ object Read {
631631
}
632632
}
633633

634-
given readGenC[T](using inst: => K0.CoproductInstances[Read, T], labelling: Labelling[T]): Read[T] with {
634+
given readGenC[T](using inst: K0.CoproductInstances[Read, T], labelling: Labelling[T]): Read[T] with {
635635
def read(s: String): Option[(T, String)] = {
636636
labelling.elemLabels.zipWithIndex.iterator.map((p: (String, Int)) => {
637637
val (label, i) = p

0 commit comments

Comments
 (0)