Ty

Contents

Ty#

class discopy.interaction.Ty(positive=None, negative=None)[source]#

Bases: NamedGeneric['natural']

An integer type is a pair of natural types.

Parameters:
  • positive (natural) – The positive half of the type.

  • negative (natural) – The negative half of the type.

Note

Integer types are parameterised by natural types, e.g.

>>> assert Ty == Ty[pivotal.Ty] and Ty[int].natural == int

The prefix operator - reverses positive and negative, e.g.

>>> x, y, z = map(Ty[int], [1, 2, 3])
>>> assert x @ -y @ z == Ty[int](1 + 3, 2)
natural#

alias of Ty