PlateMacro

dev.constructive.eo.generics.PlateMacro
object PlateMacro

Compile-time derivation of a dev.constructive.eo.optics.Plated for a recursive ADT S.

The derived plate focuses the immediate same-typed children of every case: each field whose declared type is exactly S (the "exact self-type" rule — List[S], Option[S], tuples of S, etc. are not descended in this version; their elements are leftover skeleton). For

enum Expr:
 case Var(name: String)        // 0 children
 case App(f: Expr, x: Expr)    // 2 children
 case Lam(bind: String, body: Expr) // 1 child (bind:String is skeleton)

plate[Expr] gathers App's f/x and Lam's body, leaving Var.name / Lam.bind untouched. Works on Scala 3 enums, sealed hierarchies (via Hearth's Enum.parse), and plain recursive case classes (via CaseClass.parse). Reconstruction routes through CaseClass.construct[Id] (new V(...), never .copy), so enum cases reassemble fine.

children reads the self-typed fields in declaration order; rebuild swaps them back by the same declaration-order index, so the two agree without relying on construct's call order.

Attributes

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

Members list

Grouped members

Constructors

inline def derive[S]: Plated[S]

Inline entry behind the top-level plate[S] — see the object doc for the exact-self-type child rule and accepted shapes.

Inline entry behind the top-level plate[S] — see the object doc for the exact-self-type child rule and accepted shapes.

Attributes

Source
PlateMacro.scala

Value members

Concrete methods

def deriveImpl[S](using evidence$1: Type[S], q: Quotes): Expr[Plated[S]]

Quoted-macro implementation behind derive — instantiates the Hearth-backed derivation against the call-site Quotes.

Quoted-macro implementation behind derive — instantiates the Hearth-backed derivation against the call-site Quotes.

Attributes

Source
PlateMacro.scala