HasBinding

zio.blocks.schema.binding.HasBinding
trait HasBinding[F[_, _]] extends OnlyMetadata[F, Binding]

Reads and replaces the Binding inside a Reflect node's metadata F[T, A]. The Reflect methods that need a binding, such as Reflect.Record#constructor and Reflect#fromDynamicValue, take one implicitly. The library provides instances for Binding itself (Binding.bindingHasBinding) and for BindingInstance, which pairs a binding with a derived type class instance.

A HasBinding is also a zio.blocks.schema.ReflectTransformer that turns every node's metadata into its Binding.

The typed accessors (record, constructor, seq and the others) check the binding's kind at run time and throw a RuntimeException naming the expected kind when it does not match.

Type parameters

F

the metadata type of the nodes

Attributes

Source
HasBinding.scala
Graph
Supertypes
class OnlyMetadata[F, Binding]
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def binding[T, A](fa: F[T, A]): Binding[T, A]

Returns the binding inside fa.

Returns the binding inside fa.

Attributes

Source
HasBinding.scala
def updateBinding[T, A](fa: F[T, A], f: Binding[T, A] => Binding[T, A]): F[T, A]

Returns fa with its binding replaced by the result of f. The library's instances call f at once.

Returns fa with its binding replaced by the result of f. The library's instances call f at once.

Attributes

Source
HasBinding.scala

Concrete methods

final def constructor[A](fa: F[Record, A]): Constructor[A]

Returns the constructor of the record binding of fa; throws like record when it is not a Binding.Record.

Returns the constructor of the record binding of fa; throws like record when it is not a Binding.Record.

Attributes

Source
HasBinding.scala
final def deconstructor[A](fa: F[Record, A]): Deconstructor[A]

Returns the deconstructor of the record binding of fa; throws like record when it is not a Binding.Record.

Returns the deconstructor of the record binding of fa; throws like record when it is not a Binding.Record.

Attributes

Source
HasBinding.scala
final def discriminator[A](fa: F[Variant, A]): Discriminator[A]

Returns the discriminator of the variant binding of fa; throws like variant when it is not a Binding.Variant.

Returns the discriminator of the variant binding of fa; throws like variant when it is not a Binding.Variant.

Attributes

Source
HasBinding.scala
final def dynamic(fa: F[Dynamic, DynamicValue]): Dynamic

Returns the binding of fa, which must be a Binding.Dynamic; throws a RuntimeException (Expected Binding.Dynamic) when it is another kind.

Returns the binding of fa, which must be a Binding.Dynamic; throws a RuntimeException (Expected Binding.Dynamic) when it is another kind.

Attributes

Source
HasBinding.scala
final def map[M[_, _], K, V](fa: F[Map[M], M[K, V]]): Map[M, K, V]

Returns the binding of fa, which must be a Binding.Map; throws a RuntimeException (Expected Binding.Map) when it is another kind.

Returns the binding of fa, which must be a Binding.Map; throws a RuntimeException (Expected Binding.Map) when it is another kind.

Attributes

Source
HasBinding.scala
final def mapConstructor[M[_, _], K, V](fa: F[Map[M], M[K, V]]): MapConstructor[M]

Returns the constructor of the map binding of fa; throws like map when it is not a Binding.Map.

Returns the constructor of the map binding of fa; throws like map when it is not a Binding.Map.

Attributes

Source
HasBinding.scala
final def mapDeconstructor[M[_, _], K, V](fa: F[Map[M], M[K, V]]): MapDeconstructor[M]

Returns the deconstructor of the map binding of fa; throws like map when it is not a Binding.Map.

Returns the deconstructor of the map binding of fa; throws like map when it is not a Binding.Map.

Attributes

Source
HasBinding.scala
final def matchers[A](fa: F[Variant, A]): Matchers[A]

Returns the matchers of the variant binding of fa; throws like variant when it is not a Binding.Variant.

Returns the matchers of the variant binding of fa; throws like variant when it is not a Binding.Variant.

Attributes

Source
HasBinding.scala
final def primitive[A](fa: F[Primitive, A]): Primitive[A]

Returns the binding of fa, which must be a Binding.Primitive; throws a RuntimeException (Expected Binding.Primitive) when it is another kind.

Returns the binding of fa, which must be a Binding.Primitive; throws a RuntimeException (Expected Binding.Primitive) when it is another kind.

Attributes

Source
HasBinding.scala
final def record[A](fa: F[Record, A]): Record[A]

Returns the binding of fa, which must be a Binding.Record; throws a RuntimeException (Expected Binding.Record) when it is another kind.

Returns the binding of fa, which must be a Binding.Record; throws a RuntimeException (Expected Binding.Record) when it is another kind.

Attributes

Source
HasBinding.scala
final def seq[C[_], A](fa: F[Seq[C], C[A]]): Seq[C, A]

Returns the binding of fa, which must be a Binding.Seq; throws a RuntimeException (Expected Binding.Seq) when it is another kind.

Returns the binding of fa, which must be a Binding.Seq; throws a RuntimeException (Expected Binding.Seq) when it is another kind.

Attributes

Source
HasBinding.scala
final def seqConstructor[C[_], A](fa: F[Seq[C], C[A]]): SeqConstructor[C]

Returns the constructor of the sequence binding of fa; throws like seq when it is not a Binding.Seq.

Returns the constructor of the sequence binding of fa; throws like seq when it is not a Binding.Seq.

Attributes

Source
HasBinding.scala
final def seqDeconstructor[C[_], A](fa: F[Seq[C], C[A]]): SeqDeconstructor[C]

Returns the deconstructor of the sequence binding of fa; throws like seq when it is not a Binding.Seq.

Returns the deconstructor of the sequence binding of fa; throws like seq when it is not a Binding.Seq.

Attributes

Source
HasBinding.scala
override def transformMetadata[T, A](f: F[T, A]): Lazy[Binding[T, A]]

Returns what a node holds in the result, given what it held in the source reflect.

Returns what a node holds in the result, given what it held in the source reflect.

Attributes

Definition Classes
Source
HasBinding.scala
final def updateConstructor[A](fa: F[Record, A], f: Constructor[A] => Constructor[A]): F[Record, A]

Returns fa with the constructor of its record binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Record) when the binding is another kind; with the library's instances that function runs during this call.

Returns fa with the constructor of its record binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Record) when the binding is another kind; with the library's instances that function runs during this call.

Attributes

Source
HasBinding.scala
final def updateDeconstructor[A](fa: F[Record, A], f: Deconstructor[A] => Deconstructor[A]): F[Record, A]

Returns fa with the deconstructor of its record binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Record) when the binding is another kind; with the library's instances that function runs during this call.

Returns fa with the deconstructor of its record binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Record) when the binding is another kind; with the library's instances that function runs during this call.

Attributes

Source
HasBinding.scala
final def updateDiscriminator[A](fa: F[Variant, A], f: Discriminator[A] => Discriminator[A]): F[Variant, A]

Returns fa with the discriminator of its variant binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Variant) when the binding is another kind; with the library's instances that function runs during this call.

Returns fa with the discriminator of its variant binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Variant) when the binding is another kind; with the library's instances that function runs during this call.

Attributes

Source
HasBinding.scala
final def updateMap[M[_, _], K, V](fa: F[Map[M], M[K, V]], f: Map[M, K, V] => Map[M, K, V]): F[Map[M], M[K, V]]

Returns fa with its map binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Map) when the binding is another kind; with the library's instances that function runs during this call.

Returns fa with its map binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Map) when the binding is another kind; with the library's instances that function runs during this call.

Attributes

Source
HasBinding.scala
final def updateMatchers[A](fa: F[Variant, A], f: Matchers[A] => Matchers[A]): F[Variant, A]

Returns fa with the matchers of its variant binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Variant) when the binding is another kind; with the library's instances that function runs during this call.

Returns fa with the matchers of its variant binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Variant) when the binding is another kind; with the library's instances that function runs during this call.

Attributes

Source
HasBinding.scala
final def updatePrimitive[A](fa: F[Primitive, A], f: Primitive[A] => Primitive[A]): F[Primitive, A]

Returns fa with its primitive binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Primitive) when the binding is another kind; with the library's instances that function runs during this call.

Returns fa with its primitive binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Primitive) when the binding is another kind; with the library's instances that function runs during this call.

Attributes

Source
HasBinding.scala
final def updateSeq[C[_], A](fa: F[Seq[C], C[A]], f: Seq[C, A] => Seq[C, A]): F[Seq[C], C[A]]

Returns fa with its sequence binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Seq) when the binding is another kind; with the library's instances that function runs during this call.

Returns fa with its sequence binding replaced by the result of f. It calls updateBinding with a function that throws a RuntimeException (Expected Binding.Seq) when the binding is another kind; with the library's instances that function runs during this call.

Attributes

Source
HasBinding.scala
final def variant[A](fa: F[Variant, A]): Variant[A]

Returns the binding of fa, which must be a Binding.Variant; throws a RuntimeException (Expected Binding.Variant) when it is another kind.

Returns the binding of fa, which must be a Binding.Variant; throws a RuntimeException (Expected Binding.Variant) when it is another kind.

Attributes

Source
HasBinding.scala
final def wrapper[A, B](fa: F[Wrapper[A, B], A]): Wrapper[A, B]

Returns the binding of fa, which must be a Binding.Wrapper; throws a RuntimeException (Expected Binding.Wrapper) when it is another kind.

Returns the binding of fa, which must be a Binding.Wrapper; throws a RuntimeException (Expected Binding.Wrapper) when it is another kind.

Attributes

Source
HasBinding.scala

Inherited methods

def transformDynamic(path: DynamicOptic, typeId: TypeId[DynamicValue], metadata: F[Dynamic, DynamicValue], doc: Doc, modifiers: Seq[Reflect], storedDefaultValue: Option[DynamicValue], storedExamples: Seq[DynamicValue]): Lazy[Dynamic[Binding]]

Rebuilds the dynamic node with transformMetadata(metadata).

Rebuilds the dynamic node with transformMetadata(metadata).

Attributes

Inherited from:
OnlyMetadata
Source
ReflectTransformer.scala
def transformMap[Key, Value, M[_, _]](path: DynamicOptic, key: Reflect[Binding, Key], value: Reflect[Binding, Value], typeId: TypeId[M[Key, Value]], metadata: F[Map[M], M[Key, Value]], doc: Doc, modifiers: Seq[Reflect], storedDefaultValue: Option[DynamicValue], storedExamples: Seq[DynamicValue]): Lazy[Map[Binding, Key, Value, M]]

Rebuilds the map node with transformMetadata(metadata).

Rebuilds the map node with transformMetadata(metadata).

Attributes

Inherited from:
OnlyMetadata
Source
ReflectTransformer.scala
def transformPrimitive[A](path: DynamicOptic, primitiveType: PrimitiveType[A], typeId: TypeId[A], metadata: F[Primitive, A], doc: Doc, modifiers: Seq[Reflect], storedDefaultValue: Option[DynamicValue], storedExamples: Seq[DynamicValue]): Lazy[Primitive[Binding, A]]

Rebuilds the primitive node with transformMetadata(metadata).

Rebuilds the primitive node with transformMetadata(metadata).

Attributes

Inherited from:
OnlyMetadata
Source
ReflectTransformer.scala
def transformRecord[A](path: DynamicOptic, fields: IndexedSeq[Term[Binding, A, _]], typeId: TypeId[A], metadata: F[Record, A], doc: Doc, modifiers: Seq[Reflect], storedDefaultValue: Option[DynamicValue], storedExamples: Seq[DynamicValue]): Lazy[Record[Binding, A]]

Rebuilds the record node with transformMetadata(metadata).

Rebuilds the record node with transformMetadata(metadata).

Attributes

Inherited from:
OnlyMetadata
Source
ReflectTransformer.scala
def transformSequence[A, C[_]](path: DynamicOptic, element: Reflect[Binding, A], typeId: TypeId[C[A]], metadata: F[Seq[C], C[A]], doc: Doc, modifiers: Seq[Reflect], storedDefaultValue: Option[DynamicValue], storedExamples: Seq[DynamicValue]): Lazy[Sequence[Binding, A, C]]

Rebuilds the sequence node with transformMetadata(metadata).

Rebuilds the sequence node with transformMetadata(metadata).

Attributes

Inherited from:
OnlyMetadata
Source
ReflectTransformer.scala
def transformVariant[A](path: DynamicOptic, cases: IndexedSeq[Term[Binding, A, _ <: A]], typeId: TypeId[A], metadata: F[Variant, A], doc: Doc, modifiers: Seq[Reflect], storedDefaultValue: Option[DynamicValue], storedExamples: Seq[DynamicValue]): Lazy[Variant[Binding, A]]

Rebuilds the variant node with transformMetadata(metadata).

Rebuilds the variant node with transformMetadata(metadata).

Attributes

Inherited from:
OnlyMetadata
Source
ReflectTransformer.scala
def transformWrapper[A, B](path: DynamicOptic, wrapped: Reflect[Binding, B], typeId: TypeId[A], metadata: F[Wrapper[A, B], A], doc: Doc, modifiers: Seq[Reflect], storedDefaultValue: Option[DynamicValue], storedExamples: Seq[DynamicValue]): Lazy[Wrapper[Binding, A, B]]

Rebuilds the wrapper node with transformMetadata(metadata).

Rebuilds the wrapper node with transformMetadata(metadata).

Attributes

Inherited from:
OnlyMetadata
Source
ReflectTransformer.scala