| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Proarrow.Category.Instance.Bimonoid
Description
The walking bimonoid, the PROP for monoids and comonoids satisfying the bimonoid compatibility laws. Objects count wires and tensor adds their counts. An arrow records the paths between its inputs and outputs, in copy order at each input and merge order at each output.
Synopsis
- data BIPATHS = BP Nat
- data Bimonoid (a :: BIPATHS) (b :: BIPATHS)
- type Wire = 'BP Nat1
- fromOrderedPaths :: forall (a :: Nat) (b :: Nat). (IsNat a, IsNat b) => Vec b [(Fin a, Int)] -> Maybe (Bimonoid ('BP a) ('BP b))
- orderedPaths :: forall (a :: Nat) (b :: Nat). Bimonoid ('BP a) ('BP b) -> Vec b [(Fin a, Int)]
Documentation
Instances
data Bimonoid (a :: BIPATHS) (b :: BIPATHS) Source Github #
Instances
| DaggerProfunctor Bimonoid Source Github # | |
| Promonad Bimonoid Source Github # | |
| MonoidalProfunctor Bimonoid Source Github # | |
| Profunctor Bimonoid Source Github # | |
Defined in Proarrow.Category.Instance.Bimonoid Methods dimap :: forall (c :: BIPATHS) (a :: BIPATHS) (b :: BIPATHS) (d :: BIPATHS). (c ~> a) -> (b ~> d) -> Bimonoid a b -> Bimonoid c d Source Github # lmap :: forall (c :: BIPATHS) (a :: BIPATHS) (b :: BIPATHS). (c ~> a) -> Bimonoid a b -> Bimonoid c b Source Github # rmap :: forall (b :: BIPATHS) (d :: BIPATHS) (a :: BIPATHS). (b ~> d) -> Bimonoid a b -> Bimonoid a d Source Github # (\\) :: forall (a :: BIPATHS) (b :: BIPATHS) r. ((Ob a, Ob b) => r) -> Bimonoid a b -> r Source Github # | |
| Show (Bimonoid a b) Source Github # | |
| Eq (Bimonoid a b) Source Github # | |
fromOrderedPaths :: forall (a :: Nat) (b :: Nat). (IsNat a, IsNat b) => Vec b [(Fin a, Int)] -> Maybe (Bimonoid ('BP a) ('BP b)) Source Github #
Build an arrow from one list per output, in merge order. Each pair gives the source input and its zero-based copy position. For each input the copy positions must be consecutive starting at zero, with no repetitions.
>>>import Data.Fin (fin0)>>>let crossed = [(fin0 :: Fin Nat1, 1), (fin0, 0)] V.::: V.VNil>>>fmap orderedPaths (fromOrderedPaths crossed) == Just crossedTrue