- data Point f i o = Point {}
- _mod :: Point f i o -> (o -> i) -> f -> f
- newtype f :-> a = Lens {}
- lens :: (f -> a) -> (a -> f -> f) -> f :-> a
- getL :: (f :-> a) -> f -> a
- setL :: (f :-> a) -> a -> f -> f
- modL :: (f :-> a) -> (a -> a) -> f -> f
- fmapL :: Applicative f => (a :-> b) -> f a :-> f b
- class Iso f where
- data a :<->: b = :<->: {}
- lmap :: Functor f => (a :<->: b) -> f a :<->: f b
- dimap :: (o' -> o) -> (i -> i') -> Point f i' o' -> Point f i o
- for :: (i -> o) -> (f :-> o) -> Point f i o
Documentation
Functor (Point f i) | |
Applicative (Point f i) |
fmapL :: Applicative f => (a :-> b) -> f a :-> f bSource
This isomorphism type class is like a Functor
but works in two directions.
The bijections datatype, a function that works in two directions.
for :: (i -> o) -> (f :-> o) -> Point f i oSource
Combine a partial destructor with a lens into something easily used in the
applicative instance for the hidden Point
datatype. Internally uses the
covariant in getter, contravariant in setter bi-functioral-map function.
(Please refer to the example because this function is just not explainable
on its own.)