p

cats

derived

package derived

Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Package Members

  1. package util

Type Members

  1. sealed trait IterState[+A] extends AnyRef
  2. trait MkApplicative[F[_]] extends Applicative[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of Applicative[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a constant type λ[x => T] where T: Monoid
    * it is a nested type λ[x => G[H[x]]] where G: Applicative and H: Applicative
    * it is a generic case class where all fields have an Applicative instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  3. trait MkApply[F[_]] extends Apply[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of Apply[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a constant type λ[x => T] where T: Semigroup
    * it is a nested type λ[x => G[H[x]]] where G: Apply and H: Apply
    * it is a generic case class where all fields have an Apply instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  4. trait MkCommutativeMonoid[A] extends CommutativeMonoid[A]
    Annotations
    @implicitNotFound("""Could not derive an instance of CommutativeMonoid[A] where A = ${A}.
    Make sure that A is a case class where all fields have a CommutativeMonoid instance."""
    )
  5. trait MkCommutativeSemigroup[A] extends CommutativeSemigroup[A]
    Annotations
    @implicitNotFound("""Could not derive an instance of CommutativeSemigroup[A] where A = ${A}.
    Make sure that A is a case class where all fields have a CommutativeSemigroup instance."""
    )
  6. trait MkConsK[F[_], G[_]] extends Serializable
    Annotations
    @implicitNotFound("Could not derive an instance of ConsK[${F}]")
  7. trait MkContravariant[F[_]] extends Contravariant[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of Contravariant[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a constant type λ[x => T]
    * it is a nested type λ[x => G[H[x]]] where G: Functor and H: Contravariant
    * it is a generic case class where all fields have a Contravariant instance
    * it is a generic sealed trait where all subclasses have a Contravariant instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  8. trait MkEmpty[A] extends Empty[A]
    Annotations
    @implicitNotFound("""Could not derive an instance of Empty[A] where A = ${A}.
    Make sure that A satisfies one of the following conditions:
    * it is a case class where all fields have an Empty instance
    * it is a sealed trait where exactly one subclass has an Empty instance"""
    )
  9. trait MkEmptyK[F[_]] extends EmptyK[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of EmptyK[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a constant type λ[x => T] where T: Empty
    * it is a nested type λ[x => G[H[x]]] where G: EmptyK
    * it is a nested type λ[x => G[H[x]]] where G: Pure and H: EmptyK
    * it is a generic case class where all fields have an EmptyK instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  10. trait MkEq[A] extends Eq[A]
    Annotations
    @implicitNotFound("""Could not derive an instance of Eq[A] where A = ${A}.
    Make sure that A satisfies one of the following conditions:
    * it is a case class where all fields have an Eq instance
    * it is a sealed trait where all subclasses have an Eq instance"""
    )
  11. trait MkFoldable[F[_]] extends Foldable[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of Foldable[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a constant type λ[x => T]
    * it is a nested type λ[x => G[H[x]]] where G: Foldable and H: Foldable
    * it is a generic case class where all fields have a Foldable instance
    * it is a generic sealed trait where all subclasses have a Foldable instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  12. trait MkFunctor[F[_]] extends Functor[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of Functor[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a constant type λ[x => T]
    * it is a nested type λ[x => G[H[x]]] where G: Functor and H: Functor
    * it is a nested type λ[x => G[H[x]]] where G: Contravariant and H: Contravariant
    * it is a generic case class where all fields have a Functor instance
    * it is a generic sealed trait where all subclasses have a Functor instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  13. trait MkHash[A] extends Hash[A]
    Annotations
    @implicitNotFound("""Could not derive an instance of Hash[A] where A = ${A}.
    Make sure that A satisfies one of the following conditions:
    * it is a case class where all fields have a Hash instance
    * it is a sealed trait where all subclasses have a Hash instance"""
    )
  14. trait MkInvariant[F[_]] extends Invariant[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of Invariant[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a constant type λ[x => T]
    * it is a nested type λ[x => G[H[x]]] where G: Invariant and H: Invariant
    * it is a generic case class where all fields have an Invariant instance
    * it is a generic sealed trait where all subclasses have an Invariant instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  15. trait MkIterable[F[_]] extends AnyRef
    Annotations
    @implicitNotFound("Could not convert ${F} to an Iterable")
  16. trait MkMonoid[A] extends Monoid[A]
    Annotations
    @implicitNotFound("""Could not derive an instance of Monoid[A] where A = ${A}.
    Make sure that A is a case class where all fields have a Monoid instance."""
    )
  17. trait MkMonoidK[F[_]] extends MonoidK[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of MonoidK[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a constant type λ[x => T] where T: Monoid
    * it is a nested type λ[x => G[H[x]]] where G: MonoidK
    * it is a nested type λ[x => G[H[x]]] where G: Applicative and H: MonoidK
    * it is a generic case class where all fields have a MonoidK instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  18. trait MkNonEmptyTraverse[F[_]] extends NonEmptyTraverse[F] with MkTraverse[F] with MkReducible[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of NonEmptyTraverse[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a nested type λ[x => G[H[x]]] where G: NonEmptyTraverse and H: NonEmptyTraverse
    * it is a generic case class where at least one field has a NonEmptyTraverse and the rest Traverse instances
    * it is a generic sealed trait where all subclasses have a NonEmptyTraverse instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  19. trait MkOrder[A] extends Order[A]
    Annotations
    @implicitNotFound("""Could not derive an instance of Order[A] where A = ${A}.
    Make sure that A satisfies one of the following conditions:
    * it is a case class where all fields have an Order instance
    * it is a sealed trait with exactly one subclass that has an Order instance"""
    )
  20. trait MkPartialOrder[A] extends PartialOrder[A]
    Annotations
    @implicitNotFound("""Could not derive an instance of PartialOrder[A] where A = ${A}.
    Make sure that A satisfies one of the following conditions:
    * it is a case class where all fields have a PartialOrder instance
    * it is a sealed trait where all subclasses have a PartialOrder instance"""
    )
  21. trait MkPure[F[_]] extends Pure[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of Pure[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a constant type λ[x => T] where T: Empty
    * it is a nested type λ[x => G[H[x]]] where G: Pure and H: Pure
    * it is a generic case class where all fields have a Pure instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  22. trait MkReducible[F[_]] extends Reducible[F] with MkFoldable[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of Reducible[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a nested type λ[x => G[H[x]]] where G: Reducible and H: Reducible
    * it is a generic case class where at least one field has a Reducible and the rest Foldable instances
    * it is a generic sealed trait where all subclasses have a Reducible instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  23. trait MkSemigroup[A] extends Semigroup[A]
    Annotations
    @implicitNotFound("""Could not derive an instance of Semigroup[A] where A = ${A}.
    Make sure that A is a case class where all fields have a Semigroup instance."""
    )
  24. trait MkSemigroupK[F[_]] extends SemigroupK[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of SemigroupK[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a constant type λ[x => T] where T: Semigroup
    * it is a nested type λ[x => G[H[x]]] where G: SemigroupK
    * it is a nested type λ[x => G[H[x]]] where G: Apply and H: SemigroupK
    * it is a generic case class where all fields have a SemigroupK instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  25. trait MkShow[A] extends Show[A]

    Due to a limitation in the way Shapeless' describe is currently implemented, Show can't be derived for ADTs which are _both_ recursive _and_ generic in one or more type parameters.

    Due to a limitation in the way Shapeless' describe is currently implemented, Show can't be derived for ADTs which are _both_ recursive _and_ generic in one or more type parameters.

    See: https://github.com/typelevel/kittens/pull/48#issue-249836267 https://github.com/milessabin/shapeless/issues/750

    See the test suite for more precise examples of what can and cannot be derived.

    Annotations
    @implicitNotFound("""Could not derive an instance of Show[A] where A = ${A}.
    Make sure that A satisfies one of the following conditions:
    * it is a case class where all fields have a Show instance
    * it is a sealed trait where all subclasses have a Show instance"""
    )
  26. trait MkShowPretty[A] extends ShowPretty[A]
    Annotations
    @implicitNotFound("""Could not derive an instance of ShowPretty[A] where A = ${A}.
    Make sure that A satisfies one of the following conditions:
    * it is a case class where all fields have a Show instance
    * it is a sealed trait where all subclasses have a Show instance"""
    )
  27. trait MkTraverse[F[_]] extends Traverse[F] with MkFoldable[F]
    Annotations
    @implicitNotFound("""Could not derive an instance of Traverse[F] where F = ${F}.
    Make sure that F[_] satisfies one of the following conditions:
    * it is a constant type λ[x => T]
    * it is a nested type λ[x => G[H[x]]] where G: Traverse and H: Traverse
    * it is a generic case class where all fields have a Traverse instance
    * it is a generic sealed trait where all subclasses have a Traverse instance

    Note: using kind-projector notation - https://github.com/typelevel/kind-projector"""
    )
  28. trait ShowPretty[A] extends Show[A]
  29. sealed abstract class Trivial1[F[_]] extends AnyRef

Value Members

  1. object IterState
  2. object MkApplicative extends MkApplicativeDerivation with Serializable
  3. object MkApply extends MkApplyDerivation with Serializable
  4. object MkCommutativeMonoid extends MkCommutativeMonoidDerivation with Serializable
  5. object MkCommutativeSemigroup extends MkCommutativeSemigroupDerivation with Serializable
  6. object MkConsK extends MkConsKDerivation with Serializable
  7. object MkContravariant extends MkContravariantDerivation with Serializable
  8. object MkEmpty extends MkEmptyDerivation with Serializable
  9. object MkEmptyK extends MkEmptyKDerivation with Serializable
  10. object MkEq extends MkEqDerivation with Serializable
  11. object MkFoldable extends MkFoldableDerivation with Serializable
  12. object MkFunctor extends MkFunctorDerivation with Serializable
  13. object MkHash extends MkHashDerivation with Serializable
  14. object MkInvariant extends MkInvariantDerivation with Serializable
  15. object MkIterable extends MkIterableDerivation
  16. object MkMonoid extends MkMonoidDerivation with Serializable
  17. object MkMonoidK extends MkMonoidKDerivation with Serializable
  18. object MkNonEmptyTraverse extends MkNonEmptyTraverseDerivation with Serializable
  19. object MkOrder extends MkOrderDerivation with Serializable
  20. object MkPartialOrder extends MkPartialOrderDerivation with Serializable
  21. object MkPure extends MkPureDerivation with Serializable
  22. object MkReducible extends MkReducibleDerivation with Serializable
  23. object MkSemigroup extends MkSemigroupDerivation with Serializable
  24. object MkSemigroupK extends MkSemigroupKDerivation with Serializable
  25. object MkShow extends MkShowDerivation with Serializable
  26. object MkShowPretty extends MkShowPrettyDerivation with Serializable
  27. object MkTraverse extends MkTraverseDerivation with Serializable
  28. object ShowPretty extends Serializable
  29. object Trivial1
  30. object auto

    Fully automatically derive the instance, note that this derivation is not cached, so it will re-derive every time an instance is needed in the application, which could significantly impact the compilation time.

  31. object cached

    cached cache the derived instance but this cache are global, so be cautious only use it when there is only one instance globally in your application.

  32. object function extends FunctionInstances
  33. object semiauto

    allows semi automatically derive each instance.

    allows semi automatically derive each instance. The derivation might need help when there are fields with a type constructor that comes with instances, e.g.

    scala> case class Bar(a: String)
    scala> case class Foo(bars: List[Bar])
    scala> import cats.instances.all._
    
    scala> cats.derived.semiauto.show[Foo].show(Foo(List(Bar("a"))))
    res1: String = Foo(bars = $colon$colon(head = Bar(a = a), tl$access$1 = Nil.type()))

    Note that semi.show didn't respect the native Show[List] instance

    You could either derive a Bar instance first

    scala> implicit val barShow = cats.derived.semi.show[Bar]
    
    scala> cats.derived.semiauto.show[Foo].show(Foo(List(Bar("a"))))
    res2: String = Foo(bars = List(Bar(a = a)))

    Or you can take advantage of a controlled auto derivation

     scala> implicit val fooShow: Show[Foo] = { |
               import cats.derived.auto.show._  |
               cats.derived.semiauto.show       |
            }
    scala> Foo(List(Bar("a"))).show
    res3: String = Foo(bars = List(Bar(a = a)))

Deprecated Value Members

  1. object semi extends SemiAutoInstances

    allows semi automatically derive each instance.

    allows semi automatically derive each instance. The derivation might need help when there are fields with a type constructor that comes with instances, e.g.

    scala> case class Bar(a: String)
    scala> case class Foo(bars: List[Bar])
    scala> import cats.instances.all._
    
    scala> cats.derived.semi.show[Foo].show(Foo(List(Bar("a"))))
    res1: String = Foo(bars = $colon$colon(head = Bar(a = a), tl$access$1 = Nil.type()))

    Note that semi.show didn't respect the native Show[List] instance

    You could either derive a Bar instance first

    scala> implicit val barShow = cats.derived.semi.show[Bar]
    
    scala> cats.derived.semi.show[Foo].show(Foo(List(Bar("a"))))
    res2: String = Foo(bars = List(Bar(a = a)))

    Or you can take advantage of a controlled auto derivation

     scala> implicit val fooShow: Show[Foo] = { |
               import cats.derived.auto.show._  |
               cats.derived.semi.show           |
            }
    scala> Foo(List(Bar("a"))).show
    res3: String = Foo(bars = List(Bar(a = a)))
    Annotations
    @deprecated
    Deprecated

    (Since version 2.1.0) Use semiauto instead.

Ungrouped