SearchTraversal

zio.blocks.schema.SearchTraversal

Constructors for search traversals, which the searchFor[T] step of CompanionOptics builds.

A search traversal converts the value to a DynamicValue. fold and check visit it depth first, left to right: the value itself, then record fields, case values, sequence elements, and both the keys and the values of maps. modify visits the same nodes except map keys, so a match that is a map key is read but never modified (see docs/dev/issues.md). Every node that decodes with the focus schema is a match, and the children of a match are searched too. modify applies f to each match and decodes the result with the source schema; if that decoding fails, it returns s unchanged. check reports an OpticCheck.EmptySequence when nothing matches.

Attributes

Source
Optic.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply[S, A](source: Bound[S], focus: Bound[A]): Traversal[S, A]

Creates a traversal over every value inside an S (described by source) that decodes with the schema focus.

Creates a traversal over every value inside an S (described by source) that decodes with the schema focus.

Attributes

Throws
java.lang.IllegalArgumentException

if source or focus is null

Source
Optic.scala
def apply[S, A](implicit sourceSchema: Schema[S], focusSchema: Schema[A]): Traversal[S, A]

Creates a traversal over every value inside an S that decodes as an A, with both schemas taken from implicit scope.

Creates a traversal over every value inside an S that decodes as an A, with both schemas taken from implicit scope.

Attributes

Source
Optic.scala