LensLaws
Law equations for a Lens[S, A] — Optic[S, S, A, A, Tuple2].
Ported from Monocle's monocle.law.LensLaws. Six equations total: the three classical get/replace round-trips plus modify identity, modify composition, and the consistency bridge between replace and modify.
Attributes
- Source
- LensLaws.scala
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
Value members
Abstract methods
The optic under test.
Concrete methods
modify(g) ∘ modify(f) == modify(f andThen g).
replace(a) == modify(_ => a).
get-put: replace(get(s))(s) == s — writing back what was read is a no-op.
get-put: replace(get(s))(s) == s — writing back what was read is a no-op.
Attributes
- Source
- LensLaws.scala
modify(identity) == identity.
put-get: get(replace(a)(s)) == a — a read observes the last write.
put-put: replace(a) ∘ replace(a) == replace(a) — replacing twice equals replacing once.
put-put: replace(a) ∘ replace(a) == replace(a) — replacing twice equals replacing once.
Attributes
- Source
- LensLaws.scala