Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
HUGR-py v0.12.1 API documentation.
Logo
HUGR-py v0.12.1 API documentation.
  • hugr
    • build
      • base
        • ParentBuilder
      • cfg
        • Block
        • Cfg
      • cond_loop
        • Case
        • Conditional
        • Else
        • If
        • TailLoop
        • ConditionalError
      • dfg
        • DefinitionBuilder
        • DfBase
        • Dfg
        • Function
        • DataflowError
      • function
        • Module
      • tracked_dfg
        • TrackedDfg
    • envelope
      • make_envelope
      • make_envelope_str
      • read_envelope
      • read_envelope_hugr
      • read_envelope_hugr_str
      • read_envelope_str
      • EnvelopeConfig
      • EnvelopeFormat
      • EnvelopeHeader
    • exceptions
      • MismatchedExit
      • NoSiblingAncestor
      • NotInSameCfg
      • ParentBeforeChild
    • ext
      • ExplicitBound
      • Extension
      • ExtensionObject
      • ExtensionRegistry
      • FixedHugr
      • FromParamsBound
      • OpDef
      • OpDefSig
      • TypeDef
      • NoParentExtension
    • hugr
      • base
        • Hugr
        • NodeData
      • node_port
        • Direction
        • InPort
        • Node
        • OutPort
        • ToNode
        • Wire
      • render
        • DotRenderer
        • Palette
        • RenderConfig
    • model
      • Apply
      • Block
      • Cfg
      • Conditional
      • CustomOp
      • DeclareAlias
      • DeclareConstructor
      • DeclareFunc
      • DeclareOperation
      • DefineAlias
      • DefineFunc
      • Dfg
      • Func
      • Import
      • InvalidOp
      • List
      • Literal
      • Module
      • Node
      • Op
      • Package
      • Param
      • Region
      • RegionKind
      • Splice
      • Symbol
      • TailLoop
      • Term
      • Tuple
      • Var
      • Wildcard
      • export
        • ModelExport
    • ops
      • is_dataflow_op
      • is_df_parent_op
      • AliasDecl
      • AliasDefn
      • AsExtOp
      • Break
      • CFG
      • Call
      • CallIndirect
      • Case
      • Command
      • Conditional
      • Const
      • Continue
      • Custom
      • DFG
      • DataflowBlock
      • DataflowOp
      • DfParentOp
      • ExitBlock
      • ExtOp
      • FuncDecl
      • FuncDefn
      • Input
      • Left
      • LoadConst
      • LoadFunc
      • MakeTuple
      • Module
      • Noop
      • Op
      • Output
      • RegisteredOp
      • Right
      • Some
      • Tag
      • TailLoop
      • UnpackTuple
      • IncompleteOp
      • InvalidPort
      • NoConcreteFunc
    • package
      • ExecutablePackage
      • ExtensionPointer
      • FuncDeclPointer
      • FuncDefnPointer
      • ModulePointer
      • NodePointer
      • Package
      • PackagePointer
    • qsystem
      • result
        • DataPrimitive
        • DataValue
        • HResult
        • HShots
        • QsysResult
        • QsysShot
    • std
      • collections
        • array
          • Array
          • ArrayVal
        • list
          • List
          • ListVal
        • static_array
          • StaticArray
          • StaticArrayVal
        • value_array
          • ValueArray
          • ValueArrayVal
      • float
        • FloatVal
      • int
        • INT_T
        • DivMod
        • int_t
        • IntVal
      • logic
        • Not
      • prelude
        • StringVal
    • tys
      • TypeRow
      • Qubit
      • Bool
      • Unit
      • Kind
      • get_first_sum
      • Alias
      • BoundedNatArg
      • BoundedNatParam
      • CFKind
      • ConstKind
      • Either
      • ExtType
      • FunctionKind
      • FunctionType
      • ListParam
      • Opaque
      • Option
      • OrderKind
      • PolyFuncType
      • RowVariable
      • SequenceArg
      • StringArg
      • StringParam
      • Sum
      • Tuple
      • TupleParam
      • Type
      • TypeArg
      • TypeParam
      • TypeTypeArg
      • TypeTypeParam
      • USize
      • UnitSum
      • ValueKind
      • Variable
      • VariableArg
    • utils
      • comma_sep_repr
      • comma_sep_str
      • deser_it
      • ser_it
      • BiMap
      • DeserCollection
      • SerCollection
      • NotBijection
    • val
      • Unit
      • TRUE
      • FALSE
      • bool_value
      • Extension
      • ExtensionValue
      • Function
      • Left
      • None_
      • Right
      • Some
      • Sum
      • Tuple
      • UnitSum
      • Value
  • Github
  • HUGR Specification
  • pypi
Back to top

Right¶

class hugr.val.Right(left_typ: Iterable[tys.Type], vals: Iterable[Value])[source]¶

Bases: Sum

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

In fallible contexts, this represents the success variant.

Internally a Sum with two variant rows.

Example

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

Methods

to_model

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.

Next
Some
Previous
None_
Copyright © 2025, Quantinuum
Made with Sphinx and @pradyunsg's Furo
On this page
  • Right
    • Right
      • Right.tag
      • Right.typ
      • Right.type_()
      • Right.vals