Diagram#

class discopy.closed.Diagram(inside, dom, cod, _scan=True)[source]#

Bases: discopy.monoidal.Diagram

A closed diagram is a monoidal diagram with Curry and Eval boxes.

Parameters:
  • inside (Layer) – The layers inside the diagram.

  • dom (Ty) – The domain of the diagram, i.e. its input.

  • cod (Ty) – The codomain of the diagram, i.e. its output.

ty_factory#

alias of Ty

curry(n=1, left=True)[source]#

Wrapper around Curry called by Functor.

Parameters:
  • n – The number of atomic types to curry.

  • left – Whether to curry on the left or right.

Return type:

Diagram

classmethod ev(base, exponent, left=True)[source]#

Wrapper around Eval called by Functor.

Parameters:
  • base (Ty) – The base of the exponential type to evaluate.

  • exponent (Ty) – The exponent of the exponential type to evaluate.

  • left – Whether to evaluate on the left or right.

Return type:

Eval

uncurry(left=True)[source]#

Uncurry a closed diagram by composing it with Diagram.ev().

Parameters:
  • left – Whether to uncurry on the left or right.

  • self (Diagram) –

Return type:

Diagram

curry_factory#

alias of Curry

eval_factory#

alias of Eval

exp#

alias of Exp

factory#

alias of Diagram

over#

alias of Over

sum_factory#

alias of Sum

under#

alias of Under