assoc-1.1.1: swap and assoc: Symmetric and Semigroupy Bifunctors
Safe HaskellSafe
LanguageHaskell2010

Data.Bifunctor.Swap

Synopsis

Documentation

class Swap (p :: Type -> Type -> Type) where Source #

Symmetric Bifunctors.

swap . swap = id

If p is a Bifunctor the following property is assumed to hold:

swap . bimap f g = bimap g f . swap

Swap isn't a subclass of Bifunctor, as for example

>>> newtype Bipredicate a b = Bipredicate (a -> b -> Bool)

is not a Bifunctor but has Swap instance

>>> instance Swap Bipredicate where swap (Bipredicate p) = Bipredicate (flip p)

Methods

swap :: p a b -> p b a Source #

Instances

Instances details
Swap Either Source # 
Instance details

Defined in Data.Bifunctor.Swap

Methods

swap :: Either a b -> Either b a Source #

Swap (,) Source # 
Instance details

Defined in Data.Bifunctor.Swap

Methods

swap :: (a, b) -> (b, a) Source #

Swap ((,,) x) Source # 
Instance details

Defined in Data.Bifunctor.Swap

Methods

swap :: (x, a, b) -> (x, b, a) Source #

Swap ((,,,) x y) Source # 
Instance details

Defined in Data.Bifunctor.Swap

Methods

swap :: (x, y, a, b) -> (x, y, b, a) Source #

Swap ((,,,,) x y z) Source # 
Instance details

Defined in Data.Bifunctor.Swap

Methods

swap :: (x, y, z, a, b) -> (x, y, z, b, a) Source #

Swap ((,,,,,) x y z w) Source # 
Instance details

Defined in Data.Bifunctor.Swap

Methods

swap :: (x, y, z, w, a, b) -> (x, y, z, w, b, a) Source #

Swap ((,,,,,,) x y z w v) Source # 
Instance details

Defined in Data.Bifunctor.Swap

Methods

swap :: (x, y, z, w, v, a, b) -> (x, y, z, w, v, b, a) Source #