See: Description
| Class | Description |
|---|---|
| Fold<S,A> |
A
Fold can be seen as a Getter with many targets or a weaker PTraversal which cannot modify its
target. |
| Getter<S,A> |
A
Getter can be seen as a glorified get method between a type S and a type A. |
| Iso<S,A> |
PIso when S = T and A = B |
| Lens<S,A> |
PLens with a monomorphic set function |
| Optional<S,A> |
POptional restricted to monomorphic update |
| PIso<S,T,A,B> |
A
PIso defines an isomorphism between types S, A and B, T:
get reverse.get
--------------------> -------------------->
S A T B
<-------------------- <--------------------
reverse.reverseGet reverseGet
In addition, if f and g forms an isomorphism between `A` and `B`, i.e. if `f . g = id` and `g . f = id`, then a PIso
defines an isomorphism between `S` and `T`:
S T S T
| | | |
| | | |
get | | reverseGet reverse.reverseGet | | reverse.get
| | | |
| f | | g |
A --------> B A <-------- B
A PIso is also a valid Getter, Fold, PLens, PPrism, POptional,
PTraversal and PSetter |
| PLens<S,T,A,B> | |
| POptional<S,T,A,B> | |
| PPrism<S,T,A,B> | |
| Prism<S,A> |
PPrism restricted to monomorphic update |
| PSetter<S,T,A,B> | |
| PTraversal<S,T,A,B> |
A
PTraversal can be seen as a POptional generalised to 0 to n targets where n can be infinite. |
| Setter<S,A> |
PSetter with a monomorphic modify function |
| Traversal<S,A> |