| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Monoid
Contents
Description
Synopsis
- class (Monoidal k, Ob m) => Monoid (m :: k) where
- combine :: forall {k} (m :: k). Monoid m => ((Unit :: k) ~> m) -> ((Unit :: k) ~> m) -> (Unit :: k) ~> m
- memptyS :: forall {a} (m :: a). Monoid m => ('[] :: [a]) ~> '[m]
- mappendS :: forall {k} (m :: k). Monoid m => '[m, m] ~> '[m]
- class (Monoid m, SymMonoidal k) => CommutativeMonoid (m :: k)
- newtype GenElt (x :: k) (m :: k) = GenElt (x ~> m)
- memptyAct :: forall {m} {c} (t :: (m, c) +-> c) (a :: m) (n :: c). (MonoidalAction t, Monoid a, Ob n) => n ~> Act t a n
- mappendAct :: forall {m} {c} (t :: (m, c) +-> c) (a :: m) (n :: c). (MonoidalAction t, Monoid a, Ob n) => Act t a (Act t a n) ~> Act t a n
- class (Monoidal k, Ob c) => Comonoid (c :: k) where
- class (Comonoid c, SymMonoidal k) => CocommutativeComonoid (c :: k)
- counitS :: forall {k} (c :: k). Comonoid c => '[c] ~> ('[] :: [k])
- comultS :: forall {k} (c :: k). Comonoid c => '[c] ~> '[c, c]
- data ComonoidOn (c :: k) = ComonoidOn {}
- comonoidOn :: forall {k} (c :: k). Comonoid c => ComonoidOn c
- unitComonoid :: Monoidal k => ComonoidOn (Unit :: k)
- tensorComonoid :: forall {k} (a :: k) (b :: k). SymMonoidal k => ComonoidOn a -> ComonoidOn b -> ComonoidOn (a ** b)
- counitAct :: forall {m} {c} (t :: (m, c) +-> c) (a :: m) (n :: c). (MonoidalAction t, Comonoid a, Ob n) => Act t a n ~> n
- comultAct :: forall {m} {c} (t :: (m, c) +-> c) (a :: m) (n :: c). (MonoidalAction t, Comonoid a, Ob n) => Act t a n ~> Act t a (Act t a n)
- class (forall (a :: k). Ob a => c a) => Supplies (c :: forall j. j -> Constraint) k
- fanIn :: forall {k} (n :: Nat) (a :: k). (SNatI n, Monoid a) => NFold n a ~> a
- fanOut :: forall {k} (n :: Nat) (a :: k). (SNatI n, Comonoid a) => a ~> NFold n a
- fanInS :: forall {k} (n :: Nat) (a :: k). (SNatI n, Monoid a) => NFoldS n a ~> '[a]
- fanOutS :: forall {k} (n :: Nat) (a :: k). (SNatI n, Comonoid a) => '[a] ~> NFoldS n a
Documentation
class (Monoidal k, Ob m) => Monoid (m :: k) where Source Github #
A monoid object in a monoidal category: a unit and an (associative, unital) multiplication
for the object m. At k = Type (with tensor (,)) this is the ordinary Monoid.
Instances
| Monoid 'Z Source Github # | |
| KnownNat n => Monoid (n :: Nat) Source Github # | |
| Monoid 'TRU Source Github # | |
| Monoid m => Monoid (m :: Type) Source Github # | |
| Monoid ('S 'Z) Source Github # | |
| Monoid ('CNSTRNT ()) Source Github # | |
| KnownListOf KnownNat ns => Monoid ('DF ns :: DIFF) Source Github # | Adding vectors: the change of a sum is passed back to both terms. |
| Monoid ('FH ()) Source Github # | |
| SNatI a => Monoid ('FR a :: FINREL) Source Github # |
|
| Monoid ('FS Nat1) Source Github # | |
| Monoid ('P Void) Source Github # | |
| Monoid ('P ()) Source Github # | Conjunction with False = Nothing, True = Just () |
| Monoid ('P [a] :: POINTED) Source Github # | |
| Ob as => Monoid ('D as :: DOT) Source Github # | |
| Ob as => Monoid ('S as :: SVG) Source Github # | The unit point takes the unit wire in, and the discard point gives it out. |
| (Num a, IsNat n) => Monoid ('M n :: MatK a) Source Github # | Monoids are associative, unital algebras. |
| Comonoid c => Monoid ('OP c :: OPPOSITE k) Source Github # | |
| (HasPullbacks k, HasProducts k, Ob a) => Monoid ('SP a :: SPAN k) Source Github # | |
| (Scalar e, KnownListOf KnownNat ns) => Monoid ('TN ns :: TNET e) Source Github # | Merging each wire with its partner, and the unit. |
| Monoid a => Monoid ('R a :: REV k) Source Github # | |
| (HasCoproducts k, Ob a) => Monoid ('COPR a :: COPROD k) Source Github # | |
| (Profunctor p, MonoidalProfunctor p) => Monoid (p :: j +-> k) Source Github # | |
| (HasPushouts k, HasCoproducts k, Alternative f, Ob a) => Monoid ('DC a :: DECCOSPAN f) Source Github # | |
| (Elems '[Supplies Monoid, Monoidal] cs, Ob a) => Monoid (a :: FREE cs p) Source Github # | |
combine :: forall {k} (m :: k). Monoid m => ((Unit :: k) ~> m) -> ((Unit :: k) ~> m) -> (Unit :: k) ~> m Source Github #
class (Monoid m, SymMonoidal k) => CommutativeMonoid (m :: k) Source Github #
Instances
memptyAct :: forall {m} {c} (t :: (m, c) +-> c) (a :: m) (n :: c). (MonoidalAction t, Monoid a, Ob n) => n ~> Act t a n Source Github #
mappendAct :: forall {m} {c} (t :: (m, c) +-> c) (a :: m) (n :: c). (MonoidalAction t, Monoid a, Ob n) => Act t a (Act t a n) ~> Act t a n Source Github #
class (Monoidal k, Ob c) => Comonoid (c :: k) where Source Github #
Instances
| KnownNat n => Comonoid (n :: Nat) Source Github # | |
| Ob a => Comonoid (a :: BOOL) Source Github # | |
| Ob a => Comonoid (a :: PREPARED) Source Github # | |
| KnownWires a => Comonoid (a :: Wires) Source Github # | |
| Ob a => Comonoid (a :: SIMULATOR) Source Github # | |
| Comonoid '() Source Github # | |
| Comonoid (a :: Type) Source Github # | |
| Comonoid ('CNSTRNT a :: CONSTRAINT) Source Github # | |
| KnownListOf KnownNat ns => Comonoid ('DF ns :: DIFF) Source Github # | Copying a point: the changes that come back are added. |
| Ob ('FH a) => Comonoid ('FH a :: FINHASK) Source Github # | |
| SNatI a => Comonoid ('FR a :: FINREL) Source Github # |
|
| SNatI a => Comonoid ('FS a :: FINSET) Source Github # |
|
| Comonoid ('L (Ur a) :: LINEAR) Source Github # | |
| Comonoid ('L Bool) Source Github # |
|
| Comonoid ('P x :: POINTED) Source Github # | |
| Ob as => Comonoid ('D as :: DOT) Source Github # | |
| Ob as => Comonoid ('S as :: SVG) Source Github # | |
| (MonoidalOrdinal n, Ob a) => Comonoid (a :: ORDINAL n) Source Github # | Every object is a comonoid by the diagonal and the map to the top. So the chain is
|
| (CopyDiscard k, Ob as) => Comonoid (as :: [k]) Source Github # | |
| (Num a, IsNat n) => Comonoid ('M n :: MatK a) Source Github # | |
| Monoid c => Comonoid ('OP c :: OPPOSITE k) Source Github # | |
| (HasPullbacks k, HasProducts k, Ob a) => Comonoid ('SP a :: SPAN k) Source Github # | |
| (Scalar e, KnownListOf KnownNat ns) => Comonoid ('TN ns :: TNET e) Source Github # | Copying each wire, and discarding. |
| Comonoid a => Comonoid ('R a :: REV k) Source Github # | |
| (HasProducts k, Ob a) => Comonoid ('PR a :: PROD k) Source Github # | In a category with products every object is a comonoid via the diagonal and the terminal
map. With this comonoid structure |
| (Promonad p, MonoidalProfunctor p, CopyDiscard k, Ob a) => Comonoid (a :: KLEISLI p) Source Github # | |
| (SubMonoidal ob, CopyDiscard k, Ob a) => Comonoid (a :: SUBCAT ob) Source Github # | |
| (SymMonoidal j, CopyDiscard k, Supplies CommutativeMonoid j, Profunctor p) => Comonoid (p :: j +-> k) Source Github # | |
| (CopyDiscard j, CopyDiscard k, Ob a) => Comonoid (a :: (j, k)) Source Github # | The comonoid supply of a product category, a subcategory and a strictified category are
inherited componentwise: each object's comonoid is the ambient |
| CategoryOf k => Comonoid (CatAsComonoid k :: Type -> Type) Source Github # | |
Defined in Proarrow.Category.Instance.Nat Methods counit :: CatAsComonoid k ~> (Unit :: Type -> Type) Source Github # comult :: CatAsComonoid k ~> (CatAsComonoid k ** CatAsComonoid k) Source Github # | |
| CommutativeMonoid m => Comonoid ('M :: MONOID m) Source Github # | |
| Comonoid a => Comonoid ('C a :: CPS r) Source Github # | |
| (HasPushouts k, HasCoproducts k, Alternative f, Ob a) => Comonoid ('DC a :: DECCOSPAN f) Source Github # | |
| (Elems '[Supplies Comonoid, Monoidal] cs, Ob a) => Comonoid (a :: FREE cs p) Source Github # | |
class (Comonoid c, SymMonoidal k) => CocommutativeComonoid (c :: k) Source Github #
A law-only marker for comonoids whose comultiplication cocommutes: .
Dual to swap . comult = comultCommutativeMonoid.
Instances
data ComonoidOn (c :: k) Source Github #
A comonoid structure on c carried as a value. Unit and ( are type families and so
cannot head a **)Comonoid instance, yet the unit is a comonoid and, in a symmetric monoidal
category, so is a tensor of comonoids. unitComonoid and tensorComonoid say so at the value
level, so that withMonLens can hand back the comonoid of a
composite residual (cf. withAlgP, which passes algebras the same way).
comonoidOn :: forall {k} (c :: k). Comonoid c => ComonoidOn c Source Github #
The comonoid structure of a Comonoid instance, as a value.
unitComonoid :: Monoidal k => ComonoidOn (Unit :: k) Source Github #
The unit is a comonoid, via the unitor.
tensorComonoid :: forall {k} (a :: k) (b :: k). SymMonoidal k => ComonoidOn a -> ComonoidOn b -> ComonoidOn (a ** b) Source Github #
In a symmetric monoidal category the tensor of two comonoids is a comonoid: counit both halves, or comultiply both halves and swap the inner pair.
counitAct :: forall {m} {c} (t :: (m, c) +-> c) (a :: m) (n :: c). (MonoidalAction t, Comonoid a, Ob n) => Act t a n ~> n Source Github #
comultAct :: forall {m} {c} (t :: (m, c) +-> c) (a :: m) (n :: c). (MonoidalAction t, Comonoid a, Ob n) => Act t a n ~> Act t a (Act t a n) Source Github #
class (forall (a :: k). Ob a => c a) => Supplies (c :: forall j. j -> Constraint) k Source Github #
says that every object of the category Supplies c kk satisfies the constraint c,
e.g. for a category in which every object can be copied and discarded.
The constraint comes first (at a higher-rank kind) so that a partial application like
Supplies Comonoid k has kind Supplies ComonoidKind -> Constraint and can appear in a free category's
structure list (Proarrow.Category.Instance.Free). Instances are necessarily per-c (an
instance variable cannot have a higher-rank kind); each follows the shape of the Comonoid one.
Instances
| (forall (a :: k). Ob a => Frobenius a) => Supplies Frobenius k Source Github # | |
Defined in Proarrow.Category.Monoidal.Hypergraph | |
| (forall (a :: k). Ob a => CocommutativeComonoid a) => Supplies CocommutativeComonoid k Source Github # | |
Defined in Proarrow.Monoid | |
| (forall (a :: k). Ob a => CommutativeMonoid a) => Supplies CommutativeMonoid k Source Github # | |
Defined in Proarrow.Monoid | |
| (forall (a :: k). Ob a => Comonoid a) => Supplies Comonoid k Source Github # | |
Defined in Proarrow.Monoid | |
| (forall (a :: k). Ob a => Monoid a) => Supplies Monoid k Source Github # | |
Defined in Proarrow.Monoid | |
fanInS :: forall {k} (n :: Nat) (a :: k). (SNatI n, Monoid a) => NFoldS n a ~> '[a] Source Github #
The Strictified counterpart of fanIn.
fanOutS :: forall {k} (n :: Nat) (a :: k). (SNatI n, Comonoid a) => '[a] ~> NFoldS n a Source Github #
The Strictified counterpart of fanOut.
Orphan instances
| (SymMonoidal k, Ob m) => Strong (Tensor :: k -> (k, k) -> Type) (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) Source Github # | |
| (Monoidal k, Comonoid r) => MonoidalProfunctor (Corep (Constant r) :: k -> k -> Type) Source Github # | |
| (SymMonoidal k, Monoid m) => MonoidalProfunctor (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) Source Github # | Tensoring with a monoid, |
Methods one :: Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) (Unit :: k) (Unit :: k) Source Github # (**) :: forall (x1 :: k) (x2 :: k) (y1 :: k) (y2 :: k). Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) x1 x2 -> Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) y1 y2 -> Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) (x1 ** y1) (x2 ** y2) Source Github # | |
| (Monoidal k, Monoid r) => MonoidalProfunctor (Rep (Constant r) :: k -> k -> Type) Source Github # | |
| (Monoidal k, HasCoproducts k, Monoid m) => Strong (CoprodAction :: k -> (COPROD k, k) -> Type) (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m) :: k -> k -> Type) Source Github # | |
| (Monoidal k, HasCoproducts k, Ob m) => MonoidalProfunctor (Coprod (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m)) :: COPROD k -> COPROD k -> Type) Source Github # | |
Methods one :: Coprod (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m)) (Unit :: COPROD k) (Unit :: COPROD k) Source Github # (**) :: forall (x1 :: COPROD k) (x2 :: COPROD k) (y1 :: COPROD k) (y2 :: COPROD k). Coprod (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m)) x1 x2 -> Coprod (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m)) y1 y2 -> Coprod (Rep (ActionAt (Tensor :: k -> (k, k) -> Type) m)) (x1 ** y1) (x2 ** y2) Source Github # | |
| (HasCoproducts k, Ob r) => MonoidalProfunctor (Coprod (Rep (Constant r)) :: COPROD k -> COPROD k -> Type) Source Github # | |
Methods one :: Coprod (Rep (Constant r)) (Unit :: COPROD k) (Unit :: COPROD k) Source Github # (**) :: forall (x1 :: COPROD k) (x2 :: COPROD k) (y1 :: COPROD k) (y2 :: COPROD k). Coprod (Rep (Constant r)) x1 x2 -> Coprod (Rep (Constant r)) y1 y2 -> Coprod (Rep (Constant r)) (x1 ** y1) (x2 ** y2) Source Github # | |
| (HasZeroObject k, HasBiproducts k, Ob a, Ob b) => Monoid (Id a b) Source Github # | |
| (HasZeroObject k, HasBiproducts k, Ob a, Ob b) => Semigroup (Id a b) Source Github # | |