proarrow
Safe HaskellNone
LanguageGHC2024

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

Documentation

data BIPATHS Source Github #

Constructors

BP Nat 

Instances

Instances details
Monoidal BIPATHS Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Associated Types

type Unit 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

type Unit = 'BP Nat0
type (a :: BIPATHS) ** (b :: BIPATHS) 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

type (a :: BIPATHS) ** (b :: BIPATHS) = 'BP (Plus (UN 'BP a) (UN 'BP b))

Methods

withOb2 :: forall (a :: BIPATHS) (b :: BIPATHS) r. (Ob a, Ob b) => (Ob (a ** b) => r) -> r Source Github #

leftUnitor :: forall (a :: BIPATHS). Ob a => ((Unit :: BIPATHS) ** a) ~> a Source Github #

leftUnitorInv :: forall (a :: BIPATHS). Ob a => a ~> ((Unit :: BIPATHS) ** a) Source Github #

rightUnitor :: forall (a :: BIPATHS). Ob a => (a ** (Unit :: BIPATHS)) ~> a Source Github #

rightUnitorInv :: forall (a :: BIPATHS). Ob a => a ~> (a ** (Unit :: BIPATHS)) Source Github #

associator :: forall (a :: BIPATHS) (b :: BIPATHS) (c :: BIPATHS). (Ob a, Ob b, Ob c) => ((a ** b) ** c) ~> (a ** (b ** c)) Source Github #

associatorInv :: forall (a :: BIPATHS) (b :: BIPATHS) (c :: BIPATHS). (Ob a, Ob b, Ob c) => (a ** (b ** c)) ~> ((a ** b) ** c) Source Github #

SymMonoidal BIPATHS Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

swap :: forall (a :: BIPATHS) (b :: BIPATHS). (Ob a, Ob b) => (a ** b) ~> (b ** a) Source Github #

Sized BIPATHS Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

sizeOf :: forall (a :: BIPATHS). Ob a => Int Source Github #

HasInitialObject BIPATHS Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Associated Types

type InitialObject 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

initiate :: forall (a :: BIPATHS). Ob a => (InitialObject :: BIPATHS) ~> a Source Github #

CategoryOf BIPATHS Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Associated Types

type (~>) 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

type (~>) = Bimonoid
type Ob (a :: BIPATHS) 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

type Ob (a :: BIPATHS) = WrappedOb 'BP a
HasTerminalObject BIPATHS Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Associated Types

type TerminalObject 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

terminate :: forall (a :: BIPATHS). Ob a => a ~> (TerminalObject :: BIPATHS) Source Github #

DecidableIso BIPATHS Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

isoOf :: forall (c :: (BIPATHS +-> BIPATHS) -> Constraint) (a :: BIPATHS) (b :: BIPATHS). (Ob a, Ob b) => Maybe (Optic c a a b b) Source Github #

DaggerProfunctor Bimonoid Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

dagger :: forall (a :: BIPATHS) (b :: BIPATHS). Bimonoid a b -> Bimonoid b a Source Github #

Promonad Bimonoid Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

id :: forall (a :: BIPATHS). Ob a => Bimonoid a a Source Github #

(.) :: forall (b :: BIPATHS) (c :: BIPATHS) (a :: BIPATHS). Bimonoid b c -> Bimonoid a b -> Bimonoid a c Source Github #

Ob a => Comonoid (a :: BIPATHS) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

counit :: a ~> (Unit :: BIPATHS) Source Github #

comult :: a ~> (a ** a) Source Github #

Ob a => Monoid (a :: BIPATHS) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

mempty :: (Unit :: BIPATHS) ~> a Source Github #

mappend :: (a ** a) ~> a Source Github #

MonoidalProfunctor Bimonoid Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

one :: Bimonoid (Unit :: BIPATHS) (Unit :: BIPATHS) Source Github #

(**) :: forall (x1 :: BIPATHS) (x2 :: BIPATHS) (y1 :: BIPATHS) (y2 :: BIPATHS). Bimonoid x1 x2 -> Bimonoid y1 y2 -> Bimonoid (x1 ** y1) (x2 ** y2) Source Github #

Profunctor Bimonoid Source Github # 
Instance details

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 #

type Unit Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

type Unit = 'BP Nat0
type InitialObject Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

type (~>) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

type (~>) = Bimonoid
type TerminalObject Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

type Ob (a :: BIPATHS) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

type Ob (a :: BIPATHS) = WrappedOb 'BP a
type (a :: BIPATHS) ** (b :: BIPATHS) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

type (a :: BIPATHS) ** (b :: BIPATHS) = 'BP (Plus (UN 'BP a) (UN 'BP b))

data Bimonoid (a :: BIPATHS) (b :: BIPATHS) Source Github #

Instances

Instances details
DaggerProfunctor Bimonoid Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

dagger :: forall (a :: BIPATHS) (b :: BIPATHS). Bimonoid a b -> Bimonoid b a Source Github #

Promonad Bimonoid Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

id :: forall (a :: BIPATHS). Ob a => Bimonoid a a Source Github #

(.) :: forall (b :: BIPATHS) (c :: BIPATHS) (a :: BIPATHS). Bimonoid b c -> Bimonoid a b -> Bimonoid a c Source Github #

MonoidalProfunctor Bimonoid Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

one :: Bimonoid (Unit :: BIPATHS) (Unit :: BIPATHS) Source Github #

(**) :: forall (x1 :: BIPATHS) (x2 :: BIPATHS) (y1 :: BIPATHS) (y2 :: BIPATHS). Bimonoid x1 x2 -> Bimonoid y1 y2 -> Bimonoid (x1 ** y1) (x2 ** y2) Source Github #

Profunctor Bimonoid Source Github # 
Instance details

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 # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Eq (Bimonoid a b) Source Github # 
Instance details

Defined in Proarrow.Category.Instance.Bimonoid

Methods

(==) :: Bimonoid a b -> Bimonoid a b -> Bool Github #

(/=) :: Bimonoid a b -> Bimonoid a b -> Bool 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 crossed
True

orderedPaths :: forall (a :: Nat) (b :: Nat). Bimonoid ('BP a) ('BP b) -> Vec b [(Fin a, Int)] Source Github #

The paths arriving at each output, in merge order.