invariant-0.1.0: Haskell 98 invariant functors

Safe HaskellSafe-Infered

Data.Functor.Invariant

Synopsis

Documentation

class Invariant f whereSource

Any *->* type parametric in the argument permits an instance of Invariant.

Instances should satisfy the following laws:

 invmap id id = id
 invmap f2 f2' . invmap f1 f1' = invmap (f2 . f1) (f1' . f2')

Methods

invmap :: (a -> b) -> (b -> a) -> f a -> f bSource

Instances

Invariant [] 
Invariant IO 
Invariant ZipList
Control.Applicative
Invariant ReadPrec 
Invariant ReadP 
Invariant Maybe 
Invariant Predicate

from the contravariant package

Invariant Comparison

from the contravariant package

Invariant Equivalence

from the contravariant package

Invariant ((->) a) 
Invariant (Either a) 
Invariant ((,) a) 
Invariant (Const a)
Control.Applicative
Monad m => Invariant (WrappedMonad m)
Control.Applicative
Invariant (ST s) 
Invariant (Op a)

from the contravariant package

Invariant ((,,) a b) 
Arrow arr => Invariant (WrappedArrow arr a)
Control.Applicative
(Invariant f, Invariant g) => Invariant (Compose f g)

from the contravariant package

(Invariant f, Invariant g) => Invariant (ComposeFC f g)

from the contravariant package

(Invariant f, Invariant g) => Invariant (ComposeCF f g)

from the contravariant package

Invariant ((,,,) a b c) 
Invariant ((,,,,) a b c d) 

class Invariant2 f whereSource

Any *->*->* type parametric in both arguments permits an instance of Invariant2.

Instances should satisfy the following laws:

 invmap2 id id id id = id
 invmap2 f2 f2' g2 g2' . invmap2 f1 f1' g1 g1' =
   invmap2 (f2 . f1) (f1' . f2') (g2 . g1) (g1' . g2')

Methods

invmap2 :: (a -> c) -> (c -> a) -> (b -> d) -> (d -> b) -> f a b -> f c dSource

Instances

Invariant2 (->) 
Invariant2 Either 
Invariant2 (,) 
Invariant2 Const
Control.Applicative
Invariant2 Op

from the contravariant package

Invariant2 ((,,) a) 
Arrow arr => Invariant2 (WrappedArrow arr)
Control.Applicative
Invariant2 ((,,,) a b) 
Invariant2 ((,,,,) a b c)