PLens
A Lens (or Functional Reference) is an optic that can focus into a structure for getting, setting or modifying the focus (target).
A (polymorphic) PLens is useful when setting or modifying a value for a constructed type i.e. PLens
A PLens can be seen as a pair of functions:
get: (S) -> A
meaning we can focus into anS
and extract anA
set: (B) -> (S) -> T
meaning we can focus into anS
and set a valueB
for a targetA
and obtain a modified sourceT
Parameters
the source of a PLens
the modified source of a PLens
the focus of a PLens
the modified focus of a PLens
Inheritors
Properties
DSL to compose a Optional with focus Either with a Prism with a focus of Either.Right<R>
DSL to compose a Traversal with focus Either with a Prism with a focus of Either.Right<R>
Functions
Compose a PTraversal with a PTraversal
DSL to compose FilterIndex with an Traversal for a structure S to focus in on A at given index I
Find the first element matching the predicate, if one exists.
Get the first target or null
Check if there is at least one target
Get the last target or null
Set the focus of a POptional with a value.