| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Data.Functor.Invariant
Contents
Invariant
class Invariant f where Source #
A functor is Invariant if it is parametric in its type
parameter a.
Laws
invmapidid≡idinvmapf2f2'.invmapf1f1'≡invmap(f2.f1) (f1'.f2')
Minimal complete definition
Nothing
Methods
invmap :: (a -> a') -> (a' -> a) -> f a -> f a' Source #
Given two isomorphic functions f and g, map over the
invariant parameter a.
Examples
>>>:t invmap @Identity (read @Bool) showinvmap @Identity (read @Bool) show :: Identity String -> Identity Bool
>>>invmap @Identity (read @Bool) show (Identity "True")Identity True
Instances
| Invariant ZipList Source # | |
| Invariant Identity Source # | |
| Invariant IO Source # | |
| Invariant NonEmpty Source # | |
| Invariant Maybe Source # | |
| Invariant [] Source # | |
Defined in Data.Functor.Invariant | |
| Invariant (Either e) Source # | |
| Invariant ((,) x1) Source # | |
Defined in Data.Functor.Invariant | |
| Invariant ((,,) x1 x2) Source # | |
Defined in Data.Functor.Invariant | |
| (Functor f, Functor g) => Invariant (Product f g) Source # | |
| (Functor f, Functor g) => Invariant (Sum f g) Source # | |
| Invariant ((,,,) x1 x2 x3) Source # | |
Defined in Data.Functor.Invariant | |
| (Functor f, Functor g) => Invariant (Compose f g) Source # | |