Deriver

zio.schema.Deriver
See theDeriver companion object
trait Deriver[F[_]] extends VersionSpecificDeriver[F]

Deriver builds type class instances based on a Schema.

The minimum set of methods to implement are:

  • deriveRecord
  • deriveEnum
  • derivePrimitive
  • deriveOption
  • deriveSequence
  • deriveMap
  • deriveTransformedRecord (for records with more than 22 fields)

In addition to this more methods can be overridden to handle all the supported Schema types of zio-schema:

  • deriveEither (calls deriveEnum by default)
  • deriveSet (calls deriveSequence by default)
  • deriveTupleN (calls deriveRecord by default)

The cached method converts this deriver to one that uses a cache of instances shared between macro invocations.

Each derive methods get an optional summoned implicit value of the derived type class. It is the deriver's decision whether to use the available instance (as a user defined customization for a given type) or not.

If the decision is to always accept a summoned value if there is any, use the Deriver.AutoAcceptSummoned trait which implements this automatically and only calls the trait's methods in case there is no available implicit for the actual type.

Attributes

Companion
object
Source
Deriver.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Deriver[F]

Members list

Value members

Abstract methods

def deriveEnum[A](enum: Enum[A], cases: => Chunk[WrappedF[F, _]], summoned: => Option[F[A]]): F[A]

Attributes

Source
Deriver.scala
def deriveMap[K, V](map: Map[K, V], key: => F[K], value: => F[V], summoned: => Option[F[Map[K, V]]]): F[Map[K, V]]

Attributes

Source
Deriver.scala
def deriveOption[A](option: Optional[A], inner: => F[A], summoned: => Option[F[Option[A]]]): F[Option[A]]

Attributes

Source
Deriver.scala
def derivePrimitive[A](st: StandardType[A], summoned: => Option[F[A]]): F[A]

Attributes

Source
Deriver.scala
def deriveRecord[A](record: Record[A], fields: => Chunk[WrappedF[F, _]], summoned: => Option[F[A]]): F[A]

Attributes

Source
Deriver.scala
def deriveSequence[C[_], A](sequence: Sequence[C[A], A, _], inner: => F[A], summoned: => Option[F[C[A]]]): F[C[A]]

Attributes

Source
Deriver.scala
def deriveTransformedRecord[A, B](record: Record[A], transform: Transform[A, B, _], fields: => Chunk[WrappedF[F, _]], summoned: => Option[F[B]]): F[B]

Attributes

Source
Deriver.scala

Concrete methods

Attributes

Source
Deriver.scala
def deriveEither[A, B](either: Either[A, B], left: => F[A], right: => F[B], summoned: => Option[F[Either[A, B]]]): F[Either[A, B]]

Attributes

Source
Deriver.scala
def derivePrimitiveAlias[A : ClassTag, U](st: StandardType[U], summoned: => Option[F[A]]): F[A]

Attributes

Source
Deriver.scala
def deriveSet[A](set: Set[A], inner: => F[A], summoned: => Option[F[Set[A]]]): F[Set[A]]

Attributes

Source
Deriver.scala
def deriveTupleN[T](schemasAndInstances: => Chunk[(Schema[_], WrappedF[F, _])], summoned: => Option[F[T]]): F[T]

Attributes

Source
Deriver.scala
def deriveUnknown[A : ClassTag](summoned: => Option[F[A]]): F[A]

Attributes

Source
Deriver.scala
def tryDeriveEnum[A : ClassTag](schema: Schema[A], cases: => Chunk[WrappedF[F, _]], summoned: => Option[F[A]]): F[A]

Attributes

Source
Deriver.scala
def tryDeriveRecord[A : ClassTag](schema: Schema[A], fields: => Chunk[WrappedF[F, _]], summoned: => Option[F[A]]): F[A]

Attributes

Source
Deriver.scala

Inherited methods

inline def derive[A](implicit schema: Schema[A]): F[A]

Attributes

Inherited from:
VersionSpecificDeriver
Source
VersionSpecificDeriver.scala

Concrete fields

lazy val cached: Deriver[F]

Attributes

Source
Deriver.scala