Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Documentation
class Bifunctor m => SymmetricMonoidal (m :: Type -> Type -> Type) (u :: Type) | m -> u, u -> m where Source #
A SymmetricMonoidal class
This allows you to shuffle around a bifunctor nested in itself and swap the places of the two types held in the bifunctor. For instance, for tuples:
- You can use
lassoc :: (a,(b,c)) %1-> ((a,b),c)
and then usefirst
to access thea
- You can use the dual, i.e.,
rassoc :: ((a,b),c) %1-> (a,(b,c))
and thensecond
- You can swap the first and second values with
swap :: (a,b) %1-> (b,a)
Laws
swap . swap = id
rassoc . lassoc = id
lassoc . rassoc = id
second swap . rassoc . first swap = rassoc . swap . rassoc
rassoc :: ((a `m` b) `m` c) %1 -> a `m` (b `m` c) Source #