Discriminator

zio.blocks.schema.binding.Discriminator
trait Discriminator[-A]

A Discriminator tells which case of a sum type a value belongs to: it is half of a Binding.Variant. It returns the index of the case in the order of the variant node's cases, and the Matcher at that index of the variant's Matchers downcasts the value to that case.

Type parameters

A

the sum type

Attributes

Source
Discriminator.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def discriminate(a: A): Int

Returns the 0-based index of the case that a belongs to.

Returns the 0-based index of the case that a belongs to.

Attributes

Source
Discriminator.scala