PrismMacro

dev.constructive.eo.generics.PrismMacro
object PrismMacro

Compile-time derivation of a Prism from a sum / enum / union type S to a direct child A a: S. Macro-time validation checks A is a direct child of S.

enum Shape:
 case Circle(radius: Double)
 case Square(side: Double)
val circleP = prism[Shape, Shape.Circle]
val intP    = prism[Int | String, Int]

Attributes

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

Members list

Grouped members

Constructors

inline def derive[S, A <: S]: Optic[S, S, A, A, Either]

Inline entry behind the top-level prism[S, A] — see the object doc for accepted shapes.

Inline entry behind the top-level prism[S, A] — see the object doc for accepted shapes.

Attributes

Source
PrismMacro.scala

Value members

Concrete methods

def deriveImpl[S, A <: S](using evidence$1: Type[S], evidence$2: Type[A], q: Quotes): Expr[Optic[S, S, A, A, Either]]

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
PrismMacro.scala