Module
Data.Functor.Invariant
- Package
- purescript-invariant
- Repository
- purescript/purescript-invariant
#Invariant Source
class Invariant :: (Type -> Type) -> Constraint
class Invariant f where
A type of functor that can be used to adapt the type of a wrapped function
where the parameterised type occurs in both the positive and negative
position, for example, F (a -> a)
.
An Invariant
instance should satisfy the following laws:
- Identity:
imap id id = id
- Composition:
imap g1 g2 <<< imap f1 f2 = imap (g1 <<< f1) (f2 <<< g2)
Members
imap :: forall a b. (a -> b) -> (b -> a) -> f a -> f b
Instances
- Modules
- Data.
Functor. Invariant