LensMacro
dev.constructive.eo.generics.LensMacro
object LensMacro
Compile-time derivation of a Lens (or Iso on full coverage) from one or more case-class accessors.
case class Person(age: Int, name: String)
val ageL = lens[Person](_.age) // SimpleLens, complement = remaining fields NT
val asTuple = lens[Person](_.name, _.age) // BijectionIso (full cover)
- Single-selector, partial cover →
SimpleLens[S, A, XA]withXAthe structural complement (givestransform/place/transferfor free). - Multi-selector, partial cover →
SimpleLenswith NamedTuple focus (SELECTOR order) and NamedTuple complement (DECLARATION order among non-focused fields). - Full cover at any arity →
BijectionIso[S, S, NT, NT].
Constructor synthesis routes through Hearth's CaseClass.parse[S] + construct[Id], so parameterised / recursive types and Scala 3 enum cases (which lack .copy) work uniformly via new S(...).
Attributes
- Source
- LensMacro.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
LensMacro.type
Members list
In this article