monoidal-functors-0.2.0.0: Monoidal Functors Library
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Bifunctor.BiInvariant

Contents

Synopsis

BiInvariant

class BiInvariant p where Source #

A bifunctor is BiInvariant if it is parametric in both its type parameters.

Laws

biinvmap id id id idid
biinvmap g2 g2' f2 f2' . invmap g1 g1' f1 f1'invmap (g2 . g1) (g1' . g2') (f2 . f1) (f1' . f2')

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> p a b -> p a' b' Source #

Used to apply a pair of isomorphic functions to p a b. Biinvmap picks out the appropriate half of the iso depending if p is covariant or contravariant on each parameter.

Examples

Expand
>>> :t biinvmap @(,) (read @Int) show (read @Bool) show
biinvmap @(,) (read @Int) show (read @Bool) show :: (Int, Bool) -> (String, String)
>>> biinvmap @(,) (read @Int) show (read @Bool) show (10, True)
("10","True")
>>> :t biinvmap @(->) (read @Int) show (read @Bool) show
biinvmap @(->) (read @Int) show (read @Bool) show :: (Int -> Bool) -> String -> String
>>> biinvmap @(->) (read @Int) show (read @Bool) show (\i -> i > 10) "12"
"True"

Instances

Instances details
BiInvariant Either Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Either a b -> Either a' b' Source #

BiInvariant Arg Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Arg a b -> Arg a' b' Source #

BiInvariant These Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> These a b -> These a' b' Source #

BiInvariant (,) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> (a, b) -> (a', b') Source #

Monad m => BiInvariant (Kleisli m) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Kleisli m a b -> Kleisli m a' b' Source #

BiInvariant (Const :: Type -> Type -> Type) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Const a b -> Const a' b' Source #

Bifunctor bi => BiInvariant (Biap bi) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Biap bi a b -> Biap bi a' b' Source #

BiInvariant (CopastroSum p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> CopastroSum p a b -> CopastroSum p a' b' Source #

BiInvariant (CotambaraSum p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> CotambaraSum p a b -> CotambaraSum p a' b' Source #

BiInvariant (PastroSum p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> PastroSum p a b -> PastroSum p a' b' Source #

Profunctor p => BiInvariant (TambaraSum p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> TambaraSum p a b -> TambaraSum p a' b' Source #

Profunctor p => BiInvariant (Closure p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Closure p a b -> Closure p a' b' Source #

BiInvariant (Environment p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Environment p a b -> Environment p a' b' Source #

Profunctor p => BiInvariant (CofreeMapping p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> CofreeMapping p a b -> CofreeMapping p a' b' Source #

BiInvariant (FreeMapping p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> FreeMapping p a b -> FreeMapping p a' b' Source #

BiInvariant (Copastro p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Copastro p a b -> Copastro p a' b' Source #

BiInvariant (Cotambara p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Cotambara p a b -> Cotambara p a' b' Source #

BiInvariant (Pastro p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Pastro p a b -> Pastro p a' b' Source #

Profunctor p => BiInvariant (Tambara p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Tambara p a b -> Tambara p a' b' Source #

Profunctor p => BiInvariant (CofreeTraversing p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> CofreeTraversing p a b -> CofreeTraversing p a' b' Source #

BiInvariant (FreeTraversing p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> FreeTraversing p a b -> FreeTraversing p a' b' Source #

BiInvariant (Coyoneda p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Coyoneda p a b -> Coyoneda p a' b' Source #

BiInvariant (Yoneda p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Yoneda p a b -> Yoneda p a' b' Source #

BiInvariant (Tagged :: Type -> Type -> Type) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Tagged a b -> Tagged a' b' Source #

BiInvariant ((,,) x1) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> (x1, a, b) -> (x1, a', b') Source #

BiInvariant (K1 i :: Type -> Type -> Type) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> K1 i a b -> K1 i a' b' Source #

Functor w => BiInvariant (Cokleisli w) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Cokleisli w a b -> Cokleisli w a' b' Source #

Functor f => BiInvariant (Costar f) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Costar f a b -> Costar f a' b' Source #

BiInvariant (Forget r :: Type -> Type -> TYPE LiftedRep) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Forget r a b -> Forget r a' b' Source #

BiInvariant ((,,,) x1 x2) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> (x1, x2, a, b) -> (x1, x2, a', b') Source #

BiInvariant (->) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> (a -> b) -> a' -> b' Source #

Bifunctor p => BiInvariant (Flip p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Flip p a b -> Flip p a' b' Source #

Bifunctor p => BiInvariant (WrappedBifunctor p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> WrappedBifunctor p a b -> WrappedBifunctor p a' b' Source #

Profunctor p => BiInvariant (Codensity p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Codensity p a b -> Codensity p a' b' Source #

Arrow p => BiInvariant (WrappedArrow p) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> WrappedArrow p a b -> WrappedArrow p a' b' Source #

BiInvariant ((,,,,) x1 x2 x3) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> (x1, x2, x3, a, b) -> (x1, x2, x3, a', b') Source #

BiInvariant ((,,,,,) x1 x2 x3 x4) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> (x1, x2, x3, x4, a, b) -> (x1, x2, x3, x4, a', b') Source #

(Functor f, Profunctor q) => BiInvariant (Tannen f q) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Tannen f q a b -> Tannen f q a' b' Source #

(Functor f, Profunctor q) => BiInvariant (Cayley f q) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Cayley f q a b -> Cayley f q a' b' Source #

(Profunctor p, Profunctor q) => BiInvariant (Procompose p q) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Procompose p q a b -> Procompose p q a' b' Source #

(Profunctor p, Profunctor q) => BiInvariant (Rift p q) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Rift p q a b -> Rift p q a' b' Source #

(Profunctor p, Profunctor q) => BiInvariant (Ran p q) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> Ran p q a b -> Ran p q a' b' Source #

BiInvariant ((,,,,,,) x1 x2 x3 x4 x5) Source # 
Instance details

Defined in Data.Bifunctor.BiInvariant

Methods

biinvmap :: (a' -> a) -> (a -> a') -> (b' -> b) -> (b -> b') -> (x1, x2, x3, x4, x5, a, b) -> (x1, x2, x3, x4, x5, a', b') Source #

biinvIso :: BiInvariant p => Iso (->) a a' -> Iso (->) b b' -> Iso (->) (p a b) (p a' b') Source #

BiInvariant witnesses an Isomorphism

type Coercible1 f = forall a b. Coercible a b => Coercible (f a) (f b) :: Constraint Source #

type Coercible2 f = forall a b c d. (Coercible a b, Coercible c d) => Coercible (f a c) (f b d) :: Constraint Source #