Safe Haskell | Safe |
---|---|
Language | Haskell98 |
Data.Label.Poly
Contents
Description
Lenses that allow polymorphic updates.
- data Lens cat f o
- lens :: cat f o -> cat (cat o i, f) g -> Lens cat (f -> g) (o -> i)
- point :: Point cat g i f o -> Lens cat (f -> g) (o -> i)
- get :: Lens cat (f -> g) (o -> i) -> cat f o
- modify :: Lens cat (f -> g) (o -> i) -> cat (cat o i, f) g
- set :: Arrow arr => Lens arr (f -> g) (o -> i) -> arr (i, f) g
- iso :: ArrowApply cat => Iso cat f o -> Iso cat g i -> Lens cat (f -> g) (o -> i)
- (>-) :: Arrow arr => Lens arr (j -> a) (i -> b) -> Lens arr (f -> g) (o -> i) -> Point arr g j f o
- for :: Arrow arr => Lens arr (j -> a) (i -> b) -> Lens arr (f -> g) (o -> i) -> Point arr g j f o
The polymorphic Lens type.
Abstract polymorphic lens datatype. The getter and setter functions work in some category. Categories allow for effectful lenses, for example, lenses that might fail or use state.
Instances
ArrowApply arr => Category * (Lens arr) # | Category instance for monomorphic lenses. |
Arguments
:: cat f o | Getter. |
-> cat (cat o i, f) g | Modifier. |
-> Lens cat (f -> g) (o -> i) |
Create a lens out of a getter and setter.
iso :: ArrowApply cat => Iso cat f o -> Iso cat g i -> Lens cat (f -> g) (o -> i) #
Lift a polymorphic isomorphism into a Lens
.
The isomorphism needs to be passed in twice to properly unify.