pandora-0.4.0: A box of patterns and paradigms
Safe HaskellSafe-Inferred
LanguageHaskell2010

Pandora.Pattern.Functor.Bivariant

Synopsis
  • class Bivariant (v :: * -> * -> *) where
    • (<->) :: (a -> b) -> (c -> d) -> v a c -> v b d
    • bimap :: (a -> b) -> (c -> d) -> v a c -> v b d

Documentation

class Bivariant (v :: * -> * -> *) where Source #

When providing a new instance, you should ensure it satisfies:
* Identity: bimap identity identity ≡ identity
* Parametricity: bimap  (f . g) (h . i) ≡ bimap f h . bimap g i

Minimal complete definition

(<->)

Methods

(<->) :: (a -> b) -> (c -> d) -> v a c -> v b d infixl 4 Source #

bimap :: (a -> b) -> (c -> d) -> v a c -> v b d Source #

Prefix version of <->

Instances

Instances details
Bivariant Validation Source # 
Instance details

Defined in Pandora.Paradigm.Primary.Functor.Validation

Methods

(<->) :: (a -> b) -> (c -> d) -> Validation a c -> Validation b d Source #

bimap :: (a -> b) -> (c -> d) -> Validation a c -> Validation b d Source #

Bivariant Product Source # 
Instance details

Defined in Pandora.Paradigm.Primary.Functor.Product

Methods

(<->) :: (a -> b) -> (c -> d) -> Product a c -> Product b d Source #

bimap :: (a -> b) -> (c -> d) -> Product a c -> Product b d Source #

Bivariant Conclusion Source # 
Instance details

Defined in Pandora.Paradigm.Primary.Functor.Conclusion

Methods

(<->) :: (a -> b) -> (c -> d) -> Conclusion a c -> Conclusion b d Source #

bimap :: (a -> b) -> (c -> d) -> Conclusion a c -> Conclusion b d Source #

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

Defined in Pandora.Paradigm.Primary.Functor.Tagged

Methods

(<->) :: (a -> b) -> (c -> d) -> Tagged a c -> Tagged b d Source #

bimap :: (a -> b) -> (c -> d) -> Tagged a c -> Tagged b d Source #

Bivariant (Constant :: Type -> Type -> Type) Source # 
Instance details

Defined in Pandora.Paradigm.Primary.Functor.Constant

Methods

(<->) :: (a -> b) -> (c -> d) -> Constant a c -> Constant b d Source #

bimap :: (a -> b) -> (c -> d) -> Constant a c -> Constant b d Source #

Bivariant v => Bivariant (Flip v) Source # 
Instance details

Defined in Pandora.Paradigm.Primary.Transformer.Flip

Methods

(<->) :: (a -> b) -> (c -> d) -> Flip v a c -> Flip v b d Source #

bimap :: (a -> b) -> (c -> d) -> Flip v a c -> Flip v b d Source #