UnitSum#

class hugr.val.UnitSum(tag: int, size: int)[source]#

Bases: Sum

Simple Sum with each variant being an empty row.

Example

>>> UnitSum(0, 3)
UnitSum(0, 3)
>>> UnitSum(0, 1)
Unit
>>> assert UnitSum(0, 2) == FALSE
>>> assert UnitSum(1, 2) == TRUE

Methods

type_

Report the type of the value.

Attributes

n_variants

tag

Tag identifying the variant.

typ

defines all possible variants.

vals

The values of this variant row.

tag: int#

Tag identifying the variant.

typ: Sum#

defines all possible variants.

Type:

Type of the sum

type_() Sum#

Report the type of the value.

Example

>>> TRUE.type_()
Bool
vals: list[Value]#

The values of this variant row.