Deriver

zio.blocks.schema.derive.Deriver
trait Deriver[TC[_]]

Attributes

Source
Deriver.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
Self type
Deriver[TC]

Members list

Type members

Types

type HasInstance[F[_, _]] = HasInstance[F, TC]

Attributes

Source
Deriver.scala

Value members

Abstract methods

def deriveDynamic[F[_, _]](binding: Dynamic, doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[DynamicValue], examples: Seq[DynamicValue])(implicit F: HasBinding[F], D: HasInstance[F]): Lazy[TC[DynamicValue]]

Attributes

Source
Deriver.scala
def deriveMap[F[_, _], M[_, _], K, V](key: Reflect[F, K], value: Reflect[F, V], typeId: TypeId[M[K, V]], binding: Map[M, K, V], doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[M[K, V]], examples: Seq[M[K, V]])(implicit F: HasBinding[F], D: HasInstance[F]): Lazy[TC[M[K, V]]]

Attributes

Source
Deriver.scala
def derivePrimitive[A](primitiveType: PrimitiveType[A], typeId: TypeId[A], binding: Primitive[A], doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[A], examples: Seq[A]): Lazy[TC[A]]

Attributes

Source
Deriver.scala
def deriveRecord[F[_, _], A](fields: IndexedSeq[Term[F, A, _]], typeId: TypeId[A], binding: Record[A], doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[A], examples: Seq[A])(implicit F: HasBinding[F], D: HasInstance[F]): Lazy[TC[A]]

Attributes

Source
Deriver.scala
def deriveSequence[F[_, _], C[_], A](element: Reflect[F, A], typeId: TypeId[C[A]], binding: Seq[C, A], doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[C[A]], examples: Seq[C[A]])(implicit F: HasBinding[F], D: HasInstance[F]): Lazy[TC[C[A]]]

Attributes

Source
Deriver.scala
def deriveVariant[F[_, _], A](cases: IndexedSeq[Term[F, A, _]], typeId: TypeId[A], binding: Variant[A], doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[A], examples: Seq[A])(implicit F: HasBinding[F], D: HasInstance[F]): Lazy[TC[A]]

Attributes

Source
Deriver.scala
def deriveWrapper[F[_, _], A, B](wrapped: Reflect[F, B], typeId: TypeId[A], binding: Wrapper[A, B], doc: Doc, modifiers: Seq[Reflect], defaultValue: Option[A], examples: Seq[A])(implicit F: HasBinding[F], D: HasInstance[F]): Lazy[TC[A]]

Attributes

Source
Deriver.scala

Concrete methods

final def binding[F[_, _], T, A](fa: F[T, A])(implicit F: HasBinding[F]): Binding[T, A]

Attributes

Source
Deriver.scala
final def instance[F[_, _], T, A](fa: F[T, A])(implicit D: HasInstance[F]): Lazy[TC[A]]

Attributes

Source
Deriver.scala

Attributes

Source
Deriver.scala

Attributes

Source
Deriver.scala
final def withInstance[A](instance: => TC[A])(implicit typeId: TypeId[A]): Deriver[TC]

Returns a new deriver that pre-registers a type-level instance override. During derivation, every occurrence of type A will use the supplied instance instead of deriving one.

Returns a new deriver that pre-registers a type-level instance override. During derivation, every occurrence of type A will use the supplied instance instead of deriving one.

When the returned deriver is passed to DerivationBuilder, deriver-level instance overrides take precedence over builder-level instance overrides for the same target because DerivationBuilder.derive merges them as builderOverrides ++ deriver.instanceOverrides and later entries win in the resulting .toMap.

Type parameters

A

the type whose derived instance should be replaced

Value parameters

instance

the custom type-class instance (evaluated lazily)

typeId

implicit identifier for A, used to match occurrences during derivation

Attributes

Returns

a new Deriver that wraps this deriver with the additional override

Source
Deriver.scala
final def withInstance[A, B](typeId: TypeId[A], termName: String, instance: => TC[B]): Deriver[TC]

Returns a new deriver that pre-registers a field-level instance override. During derivation, the field named termName inside the parent record/variant identified by typeId will use the supplied instance instead of deriving one.

Returns a new deriver that pre-registers a field-level instance override. During derivation, the field named termName inside the parent record/variant identified by typeId will use the supplied instance instead of deriving one.

This is a medium-precision override between optic-based (exact path) and type-based (all occurrences).

Type parameters

A

the parent record or variant type that owns the field

B

the type of the field being overridden. Note that B is not statically checked against the actual field type; a mismatch will surface as a runtime error during codec use, not at derivation time.

Value parameters

instance

the custom type-class instance for the field (evaluated lazily)

termName

the name of the field (or variant case) to override. If no field with this name exists in the target type, the override is silently ignored during derivation (matching DerivationBuilder.instance behaviour).

typeId

identifier for the parent type A

Attributes

Returns

a new Deriver that wraps this deriver with the additional override

Source
Deriver.scala
final def withModifier[A](typeId: TypeId[A], modifier: Reflect): Deriver[TC]

Returns a new deriver that pre-registers a reflect-level modifier override. During derivation, every occurrence of the type identified by typeId will have the modifier prepended to its modifiers.

Returns a new deriver that pre-registers a reflect-level modifier override. During derivation, every occurrence of the type identified by typeId will have the modifier prepended to its modifiers.

Type parameters

A

the type to attach the modifier to

Value parameters

modifier

the reflect-level modifier to prepend

typeId

identifier for A

Attributes

Returns

a new Deriver that wraps this deriver with the additional override

Source
Deriver.scala
final def withModifier[A](typeId: TypeId[A], termName: String, modifier: Term): Deriver[TC]

Returns a new deriver that pre-registers a term-level modifier override. During derivation, the field named termName inside the parent type identified by typeId will have the modifier applied.

Returns a new deriver that pre-registers a term-level modifier override. During derivation, the field named termName inside the parent type identified by typeId will have the modifier applied.

Type parameters

A

the parent record or variant type that owns the field

Value parameters

modifier

the term-level modifier to apply

termName

the name of the field (or variant case) to modify. If no field with this name exists in the target type, the override is silently ignored.

typeId

identifier for A

Attributes

Returns

a new Deriver that wraps this deriver with the additional override

Source
Deriver.scala