Sum#

class hugr.val.Sum(tag: int, typ: Sum, vals: list[Value])[source]#

Bases: Value

Sum-of-product value.

Example

>>> Sum(0, tys.Sum([[tys.Bool], [tys.Unit]]), [TRUE])
Sum(tag=0, typ=Sum([[Bool], [Unit]]), vals=[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[source]#

Report the type of the value.

Example

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

The values of this variant row.