Skip to content

Commit

Permalink
Update to Shapeless 3.2.0 and remove util.Kinds
Browse files Browse the repository at this point in the history
  • Loading branch information
joroKr21 committed Sep 16, 2022
1 parent 97eec53 commit a5e9264
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 45 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ val munitVersion = "1.0.0-M6"
val disciplineMunitVersion = "2.0.0-M3"
val kindProjectorVersion = "0.13.2"
val shapeless2Version = "2.3.10"
val shapeless3Version = "3.1.0"
val shapeless3Version = "3.2.0"

lazy val commonSettings = Seq(
scalacOptions ++= Seq(
Expand Down
5 changes: 2 additions & 3 deletions core/src/main/scala-3/cats/derived/DerivedEmpty.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cats.derived

import alleycats.Empty
import cats.derived.util.Kinds
import shapeless3.deriving.K0

import scala.annotation.implicitNotFound
Expand All @@ -19,7 +18,7 @@ object DerivedEmpty:
summonInline[DerivedEmpty[A]].instance

given product[A](using inst: K0.ProductInstances[Or, A]): DerivedEmpty[A] =
Empty(inst.unify.construct([A] => (A: Empty[A]) => A.empty))
Empty(inst.unify.construct([a] => (_: Empty[a]).empty))

inline given coproduct[A](using gen: K0.CoproductGeneric[A]): DerivedEmpty[A] =
Kinds.summonOne0[Or, gen.MirroredElemTypes, A].unify
Empty(gen.withOnly[Or, A]([a <: A] => (_: Or[a]).unify.empty))
3 changes: 1 addition & 2 deletions core/src/main/scala-3/cats/derived/DerivedEmptyK.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cats.derived

import alleycats.{Empty, EmptyK, Pure}
import cats.derived.util.Kinds
import shapeless3.deriving.{Const, K1}

import scala.annotation.implicitNotFound
Expand Down Expand Up @@ -39,4 +38,4 @@ object DerivedEmptyK:
def empty[A]: F[A] = inst.unify.construct([f[_]] => (E: EmptyK[f]) => E.empty[A])

inline given coproduct[F[_]](using gen: K1.CoproductGeneric[F]): DerivedEmptyK[F] =
Kinds.summonOne1[Or, gen.MirroredElemTypes, F].unify
gen.withOnly[Or, EmptyK[F]]([f[x] <: F[x]] => (ek: Or[f]) => ek.unify.asInstanceOf[EmptyK[F]])
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ object DerivedNonEmptyTraverse:
with DerivedFunctor.Generic[Traverse, F] {}

inline given [F[_]](using gen: K1.ProductGeneric[F]): DerivedNonEmptyTraverse[F] =
product(K1.summonFirst[Or, gen.MirroredElemTypes, Const[Any]].unify)
product(K1.summonFirst[Or, gen.MirroredElemTypes].unify)

given [F[_]](using inst: => K1.CoproductInstances[Or, F]): DerivedNonEmptyTraverse[F] =
given K1.CoproductInstances[NonEmptyTraverse, F] = inst.unify
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala-3/cats/derived/DerivedReducible.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object DerivedReducible:
new Product[Foldable, F](ev) {}

inline given [F[_]](using gen: K1.ProductGeneric[F]): DerivedReducible[F] =
product(K1.summonFirst[Or, gen.MirroredElemTypes, Const[Any]].unify)
product(K1.summonFirst[Or, gen.MirroredElemTypes].unify)

given [F[_]](using inst: => K1.CoproductInstances[Or, F]): DerivedReducible[F] =
given K1.CoproductInstances[Reducible, F] = inst.unify
Expand Down
37 changes: 0 additions & 37 deletions core/src/main/scala-3/cats/derived/util/Kinds.scala

This file was deleted.

0 comments on commit a5e9264

Please sign in to comment.