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

Safe Haskell | Safe-Inferred
Language | Haskell2010

Data.Bifunctor.Assoc

Synopsis

- class Bifunctor p => Assoc p where
  - assoc :: p (p a b) c -> p a (p b c)
  - unassoc :: p a (p b c) -> p (p a b) c

# Documentation

class Bifunctor p => Assoc p where #

"Semigroup-y" `Bifunctor`s.

    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) #

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

#### Instances

Instances details

Assoc Either # |
Instance details Defined in Data.Bifunctor.Assoc Methods assoc :: Either (Either a b) c -> Either a (Either b c) # unassoc :: Either a (Either b c) -> Either (Either a b) c #
Assoc (,) # |
Instance details Defined in Data.Bifunctor.Assoc Methods assoc :: ((a, b), c) -> (a, (b, c)) # unassoc :: (a, (b, c)) -> ((a, b), c) #
Assoc (Const :: Type -> Type -> Type) # |
Instance details Defined in Data.Bifunctor.Assoc Methods assoc :: Const (Const a b) c -> Const a (Const b c) # unassoc :: Const a (Const b c) -> Const (Const a b) c #
Assoc (Tagged :: Type -> Type -> Type) # |
Instance details Defined in Data.Bifunctor.Assoc Methods assoc :: Tagged (Tagged a b) c -> Tagged a (Tagged b c) # unassoc :: Tagged a (Tagged b c) -> Tagged (Tagged a b) c #
Assoc p => Assoc (Flip p) # |
Instance details Defined in Data.Bifunctor.Assoc Methods assoc :: Flip p (Flip p a b) c -> Flip p a (Flip p b c) # unassoc :: Flip p a (Flip p b c) -> Flip p (Flip p a b) c #