HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulelinear-base-0.4.0Haskell2010

Data.Bifunctor.Linear.Internal.SymmetricMonoidal

  • 1 class
  • Packagelinear-base-0.4.0
  • Exports1
  • LanguageHaskell2010
  • LicenceMIT
  • SourceSymmetricMonoidal.hs
classclass Bifunctor m => SymmetricMonoidal (m :: Type -> Type -> Type) u | m -> u, u -> m where
#

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 use first to access the a

  • You can use the dual, i.e., rassoc :: ((a,b),c) %1-> (a,(b,c)) and then second

  • 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

Methods

  • rassoc :: m (m a b) c %1 -> m a (m b c)
  • lassoc :: m a (m b c) %1 -> m (m a b) c
  • swap :: m a b %1 -> m b a
Instances2SymmetricMonoidal