Left#

class hugr.val.Left(vals: Iterable[Value], right_typ: Iterable[tys.Type])[source]#

Bases: Sum

Left variant of a tys.Either type, containing a list of values.

In fallible contexts, this represents the failure variant.

Example

>>> left = Left([TRUE, FALSE], [tys.Bool])
>>> str(left)
'Left(TRUE, FALSE)'
>>> str(left.type_())
'Either((Bool, Bool), Bool)'

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.