Optional

zio.blocks.schema.Optional
See theOptional companion trait
object Optional

Constructors for Optional: compositions of two optics that give an optional, and optionals on an index, a map key or a wrapped value.

Attributes

Companion
trait
Source
Optic.scala
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Optional.type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
Source
Mirror.scala
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror
Source
Mirror.scala

Value members

Concrete methods

def apply[S, T, A](first: Optional[S, T], second: Lens[T, A]): Optional[S, A]

Composes an optional with a lens. The same as first(second).

Composes an optional with a lens. The same as first(second).

Attributes

Throws
java.lang.IllegalArgumentException

if first or second is null

Source
Optic.scala
def apply[S, T, A <: T](first: Optional[S, T], second: Prism[T, A]): Optional[S, A]

Composes an optional with a prism. The same as first(second).

Composes an optional with a prism. The same as first(second).

Attributes

Throws
java.lang.IllegalArgumentException

if first or second is null

Source
Optic.scala
def apply[S, T, A](first: Optional[S, T], second: Optional[T, A]): Optional[S, A]

Composes two optionals. The same as first(second).

Composes two optionals. The same as first(second).

Attributes

Throws
java.lang.IllegalArgumentException

if first or second is null

Source
Optic.scala
def apply[S, T, A <: T](first: Lens[S, T], second: Prism[T, A]): Optional[S, A]

Composes a lens with a prism. The same as first(second).

Composes a lens with a prism. The same as first(second).

Attributes

Throws
java.lang.IllegalArgumentException

if first or second is null

Source
Optic.scala
def apply[S, T, A](first: Lens[S, T], second: Optional[T, A]): Optional[S, A]

Composes a lens with an optional. The same as first(second).

Composes a lens with an optional. The same as first(second).

Attributes

Throws
java.lang.IllegalArgumentException

if first or second is null

Source
Optic.scala
def apply[S, T <: S, A](first: Prism[S, T], second: Lens[T, A]): Optional[S, A]

Composes a prism with a lens. The same as first(second).

Composes a prism with a lens. The same as first(second).

Attributes

Throws
java.lang.IllegalArgumentException

if first or second is null

Source
Optic.scala
def apply[S, T <: S, A](first: Prism[S, T], second: Optional[T, A]): Optional[S, A]

Composes a prism with an optional. The same as first(second).

Composes a prism with an optional. The same as first(second).

Attributes

Throws
java.lang.IllegalArgumentException

if first or second is null

Source
Optic.scala
def at[A, C[_]](seq: Bound[A, C], index: Int): Optional[C[A], A]

Creates an optional on the element at index of a sequence. A sequence with index elements or fewer has no focus (OpticCheck.SequenceIndexOutOfBounds).

Creates an optional on the element at index of a sequence. A sequence with index elements or fewer has no focus (OpticCheck.SequenceIndexOutOfBounds).

Attributes

Throws
java.lang.IllegalArgumentException

if seq is null or index is negative

Source
Optic.scala
def atKey[K, V, M[_, _]](map: Bound[K, V, M], key: K): Optional[M[K, V], V]

Creates an optional on the value at key in a map. A map without key has no focus (OpticCheck.MissingKey), and replace does not add the key.

Creates an optional on the value at key in a map. A map without key has no focus (OpticCheck.MissingKey), and replace does not add the key.

Attributes

Throws
Source
Optic.scala
def wrapped[A, B](wrapper: Bound[A, B]): Optional[A, B]

Creates an optional on the value inside a wrapper, such as a schema built with Schema#transform. It reads with the wrapper's unwrap and writes with its wrap. When either throws a SchemaError, the focus counts as missing (OpticCheck.WrappingError); other exceptions propagate.

Creates an optional on the value inside a wrapper, such as a schema built with Schema#transform. It reads with the wrapper's unwrap and writes with its wrap. When either throws a SchemaError, the focus counts as missing (OpticCheck.WrappingError); other exceptions propagate.

Attributes

Throws
Source
Optic.scala