Lens
Constructors for Lens — the always-present single-focus optic, backed by Tuple2. A Lens[S, A] (short for Optic[S, S, A, A, Tuple2]) reads a field via get(s) and rewrites it via modify / replace. The eo-generics module's lens[S](_.field) macro derives both.
Attributes
- Source
- Lens.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Lens.type
Members list
Grouped members
Constructors
Monomorphic constructor (S = T, A = B).
Monomorphic constructor (S = T, A = B).
Attributes
- Example
-
case class Person(name: String, age: Int) val ageL = Lens[Person, Int](_.age, (p, a) => p.copy(age = a)) - Source
- Lens.scala
Curried variant — accepts replace: A => S => S instead of (S, A) => S.
Lens focusing the first element of a Tuple2. Returns a SimpleLens so place / transfer / transform land without extra evidence (S = T, A = B).
Lens focusing the first element of a Tuple2. Returns a SimpleLens so place / transfer / transform land without extra evidence (S = T, A = B).
Attributes
- Source
- Lens.scala
Polymorphic counterpart to curried.
Polymorphic constructor — allows S and T to differ.
Lens focusing the second element of a Tuple2.