JsoniterPrismMacro

dev.constructive.eo.jsoniter.JsoniterPrismMacro

Macros backing the JsoniterPath builder — .field(_.fieldName), selectDynamic, at(i) and each — for every eo-jsoniter optic: the whole-array JsoniterPrism / JsoniterTraversal and their in-place faces. Extracts the field name from the selector AST (same pattern as eo-circe's JsonPrismMacro) and emits a widenField / widenIndex / toTraversal call on the builder, which builds the next optic of the builder's own kind (P, or T for .each). The single divergence from the circe macro: one JsonValueCodec[B] summon instead of the Encoder[B] / Decoder[B] pair.

 val streetP: JsoniterPrism[String] =
   JsoniterPrism[Person].field(_.address).field(_.street)
 val streetIn: JsoniterInPlacePrism[String] =
   JsoniterPrism.inPlace[Person].field(_.address).field(_.street)

Attributes

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

Members list

Value members

Concrete methods

def atImpl[A, P[_]](parent: Expr[JsoniterPath[A, P]], iE: Expr[Int])(using evidence$1: Type[A], evidence$2: Type[P], q: Quotes): Expr[Any]

.at(i) — verifies A <: Iterable, summons the element codec, emits widenIndex.

.at(i) — verifies A <: Iterable, summons the element codec, emits widenIndex.

Attributes

Source
JsoniterPrismMacro.scala
def eachImpl[A, T[_]](parent: Expr[JsoniterPrismPath[A, _[_], T]])(using evidence$1: Type[A], evidence$2: Type[T], q: Quotes): Expr[Any]

.each — emits toTraversal[B] over A's element type.

.each — emits toTraversal[B] over A's element type.

Attributes

Source
JsoniterPrismMacro.scala
def fieldImpl[A, B, P[_]](parent: Expr[JsoniterPath[A, P]], selector: Expr[A => B], codecB: Expr[JsonValueCodec[B]])(using evidence$1: Type[A], evidence$2: Type[B], evidence$3: Type[P], q: Quotes): Expr[P[B]]

Child P[B] from parent via a (_.field) selector.

Child P[B] from parent via a (_.field) selector.

Attributes

Source
JsoniterPrismMacro.scala
def selectFieldImpl[A, P[_]](parent: Expr[JsoniterPath[A, P]], nameE: Expr[String])(using evidence$1: Type[A], evidence$2: Type[P], q: Quotes): Expr[Any]

Drives JsoniterPrism[Person].address. Looks the field up on A's schema, summons its codec, emits widenField. Returns Expr[Any] so transparent inline refines per call site.

Drives JsoniterPrism[Person].address. Looks the field up on A's schema, summons its codec, emits widenField. Returns Expr[Any] so transparent inline refines per call site.

Attributes

Source
JsoniterPrismMacro.scala