Skip to content

Commit

Permalink
Use SAM in generic coproduct ShowPretty derivation (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
joroKr21 authored Apr 21, 2021
1 parent eea48df commit 990de38
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions core/src/main/scala/cats/derived/showPretty.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package cats.derived

import cats.Show
import cats.derived.util.VersionSpecific.{Lazy, OrElse}
import shapeless._
import shapeless.labelled._
import util.VersionSpecific.{Lazy, OrElse}

import scala.annotation.implicitNotFound
import scala.reflect.ClassTag
Expand Down Expand Up @@ -98,7 +98,5 @@ sealed abstract private[derived] class MkShowPrettyGenericCoproduct {
implicit def mkShowPrettyGenericCoproduct[A, R <: Coproduct](implicit
A: Generic.Aux[A, R],
R: Lazy[MkShowPretty[R]]
): MkShowPretty[A] = new MkShowPretty[A] { // Using SAM here makes it not Serializable.
override def showLines(a: A) = R.value.showLines(A.to(a))
}
): MkShowPretty[A] = a => R.value.showLines(A.to(a))
}

0 comments on commit 990de38

Please sign in to comment.