Skip to content

Commit

Permalink
Replace given with implicit def
Browse files Browse the repository at this point in the history
  • Loading branch information
RustedBones committed Jan 4, 2024
1 parent 4c25d91 commit 88d5178
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions cats/src/main/scala-3/magnolify/cats/CatsMacros.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,33 +29,33 @@ import scala.deriving.Mirror
trait AutoDerivation extends LowPriority0Implicits

trait LowPriority0Implicits extends LowPriority1Implicits:
inline given genShow[T](using Mirror.Of[T]): Show[T] = ShowDerivation.gen[T]
inline implicit def genShow[T](using Mirror.Of[T]): Show[T] = ShowDerivation.gen[T]
// CommutativeGroup <: Group | CommutativeMonoid
inline given genCommutativeGroup[T](using Mirror.Of[T]): CommutativeGroup[T] =
inline implicit def genCommutativeGroup[T](using Mirror.Of[T]): CommutativeGroup[T] =
CommutativeGroupDerivation.gen[T]
// Hash <: Eq
inline given genHash[T](using Mirror.Of[T]): Hash[T] = HashDerivation.gen[T]
inline implicit def genHash[T](using Mirror.Of[T]): Hash[T] = HashDerivation.gen[T]

trait LowPriority1Implicits extends LowPriority2Implicits:
inline given genEq[T](using Mirror.Of[T]): Eq[T] = EqDerivation.gen[T]
inline implicit def genEq[T](using Mirror.Of[T]): Eq[T] = EqDerivation.gen[T]
// Group <: Monoid
inline given genGroup[T](using Mirror.Of[T]): Group[T] = GroupDerivation.gen[T]
inline implicit def genGroup[T](using Mirror.Of[T]): Group[T] = GroupDerivation.gen[T]

trait LowPriority2Implicits extends LowPriority3Implicits:
// CommutativeMonoid <: Monoid | CommutativeSemigroup
inline given genCommutativeMonoid[T](using Mirror.Of[T]): CommutativeMonoid[T] =
inline implicit def genCommutativeMonoid[T](using Mirror.Of[T]): CommutativeMonoid[T] =
CommutativeMonoidDerivation.gen[T]

trait LowPriority3Implicits extends LowPriority4Implicits:
// CommutativeSemigroup <: Semigroup
inline given genCommutativeSemigroup[T](using Mirror.Of[T]): CommutativeSemigroup[T] =
inline implicit def genCommutativeSemigroup[T](using Mirror.Of[T]): CommutativeSemigroup[T] =
CommutativeSemigroupDerivation.gen[T]
// Monoid <: Semigroup
inline given genMonoid[T](using Mirror.Of[T]): Monoid[T] = MonoidDerivation.gen[T]
inline implicit def genMonoid[T](using Mirror.Of[T]): Monoid[T] = MonoidDerivation.gen[T]

trait LowPriority4Implicits extends LowPriority5Implicits:
// Band <: Semigroup
inline given genBand[T](using Mirror.Of[T]): Band[T] = BandDerivation.gen[T]
inline implicit def genBand[T](using Mirror.Of[T]): Band[T] = BandDerivation.gen[T]

trait LowPriority5Implicits:
inline given genSemigroup[T](using Mirror.Of[T]): Semigroup[T] = SemigroupDerivation.gen[T]
inline implicit def genSemigroup[T](using Mirror.Of[T]): Semigroup[T] = SemigroupDerivation.gen[T]

0 comments on commit 88d5178

Please sign in to comment.