assoc-1: swap and assoc: Symmetric and Semigroupy Bifunctors

Safe HaskellSafe
LanguageHaskell2010

Data.Bifunctor.Assoc

Synopsis

Documentation

class Bifunctor p => Assoc p where Source #

"Semigroup-y" Bifunctors.

assoc . unassoc = id
unassoc . assoc = id
assoc . bimap (bimap f g) h = bimap f (bimap g h) . assoc

This library doesn't provide Monoidal class, with left and right unitors. Are they useful in practice?

Methods

assoc :: p (p a b) c -> p a (p b c) Source #

unassoc :: p a (p b c) -> p (p a b) c Source #

Instances
Assoc Either Source # 
Instance details

Defined in Data.Bifunctor.Assoc

Methods

assoc :: Either (Either a b) c -> Either a (Either b c) Source #

unassoc :: Either a (Either b c) -> Either (Either a b) c Source #

Assoc (,) Source # 
Instance details

Defined in Data.Bifunctor.Assoc

Methods

assoc :: ((a, b), c) -> (a, (b, c)) Source #

unassoc :: (a, (b, c)) -> ((a, b), c) Source #

Assoc p => Assoc (Flip p) Source # 
Instance details

Defined in Data.Bifunctor.Assoc

Methods

assoc :: Flip p (Flip p a b) c -> Flip p a (Flip p b c) Source #

unassoc :: Flip p a (Flip p b c) -> Flip p (Flip p a b) c Source #