Constructor for Iso — a bijective single-focus optic, backed by Direct. An Iso[S, A] (short for Optic[S, S, A, A, Direct]) encodes a data-shape bijection. Direct[X, A] = A carries no leftover, so every Iso operation reduces to plain function application.
Construct an Iso from forward get: S => A and reverse reverseGet: B => T. Polymorphic; use S = T = A = B for the monomorphic case.
Construct an Iso from forward get: S => A and reverse reverseGet: B => T. Polymorphic; use S = T = A = B for the monomorphic case.
Attributes
Example
case class Person(age: Int, name: String)
val pairIso = Iso[(Int, String), (Int, String), Person, Person](
t => Person(t._1, t._2),
p => (p.age, p.name),
)