Lazy versions of set, over.
These actions check that the old and the new version are different before writing.
They are useful when used together with Html.lazy, because it uses reference
equality for complex structures. Therefore, using lazy set and over will
not prevent Html.lazy from doing its work.
get is also reexported for convenience.
The set function takes:
sub,super
and it returns the data structure, with the accessible field changed to the set value.
The structure is changed only if the new field is different from the old one.set (foo << bar) "Hi!" myRecordThe over function takes:
(sub -> sub),super
and it returns the data structure, with the accessible field changed by applying
the function to the existing value.
The structure is changed only if the new field is different from the old one.over (foo << qux) ((+) 1) myRecord
The get function takes:
superand returns the value accessed by that combinator.