Expand description
Implements Profunctor, Strong, and Choice traits, primarily for function types.
Structs§
- Check
- A simple struct for demonstrating lenses.
- Forget
- A
Profunctorthat “forgets” its second type parameter (BPhantom) and maps its first type parameter (AInput) to a fixed result typeR. - Lens
- A
Lensis a type of Optic that focuses on a partAof a wholeS, allowing both getting the part and setting it (which might changeStoTandAtoB). - Optic
- Represents a general Optic using Profunctor encoding.
Traits§
- Choice
Choiceprofunctors are profunctors that can operate on sum types (Result).- Profunctor
- A
Profunctoris a bifunctor that is contravariant in its first type parameter and covariant in its second type parameter. - Strong
Strongprofunctors are profunctors that can operate on product types (tuples).
Functions§
- _1
- A
Lensthat focuses on the first element of a pair(A, C). Allows gettingAand settingAtoB, resulting in(B, C). - _2
- A
Lensthat focuses on the second element of a pair(C, A). Allows gettingAand settingAtoB, resulting in(C, B). - _key
- A
Lensthat focuses on thekeyfield of aCheckstruct. Allows gettingcheck.keyand setting it. - lcmap
- Maps the input of a
Profunctor(contravariant mapping).lcmap(f, p)is equivalent top.dimap(f, id). - lens
- Constructs a
Lensfrom a getter function and a setter function. - lens_
- Internal helper to construct a Lens using the “van Laarhoven” representation.
Not typically called directly by users.
lensfunction is preferred. - rmap
- Maps the output of a
Profunctor(covariant mapping).rmap(f, p)is equivalent top.dimap(id, f). - view
- Extracts a value
Afrom a structureSusing aAGetter.