hydra.paths module

Subterm and subtype access, and the link view of a graph.

class hydra.paths.SubtermAttribute(path: Annotated[SubtermPath, 'The subterm path at which the attribute occurs'], target: Annotated[TermAttribute, 'The attribute value'])

Bases: object

A link from a node to a non-term attribute of a position.

class Builder(_path: 'SubtermPath' = None, _target: 'TermAttribute' = None)

Bases: object

build()
path(path)
target(target)
PATH = Name(value='path')
TARGET = Name(value='target')
TYPE_ = Name(value='hydra.paths.SubtermAttribute')
static builder()
path: Annotated[SubtermPath, 'The subterm path at which the attribute occurs']
target: Annotated[TermAttribute, 'The attribute value']
with_path(path)
with_target(target)
class hydra.paths.SubtermEdge(path: Annotated[SubtermPath, 'The subterm path at which the reference occurs'], target: Annotated[Name, 'The name of the referenced binding of the graph'])

Bases: object

A link from a node to another binding of the graph, addressed by the path at which it occurs.

class Builder(_path: 'SubtermPath' = None, _target: 'hydra.core.Name' = None)

Bases: object

build()
path(path)
target(target)
PATH = Name(value='path')
TARGET = Name(value='target')
TYPE_ = Name(value='hydra.paths.SubtermEdge')
static builder()
path: Annotated[SubtermPath, 'The subterm path at which the reference occurs']
target: Annotated[Name, 'The name of the referenced binding of the graph']
with_path(path)
with_target(target)
class hydra.paths.SubtermGraph(nodes: Annotated[Sequence[SubtermNode], 'All nodes in the graph'])

Bases: object

The link view of a graph as subterm nodes and their links.

class Builder(_nodes: 'Sequence[SubtermNode]' = None)

Bases: object

build()
nodes(nodes)
NODES = Name(value='nodes')
TYPE_ = Name(value='hydra.paths.SubtermGraph')
static builder()
nodes: Annotated[Sequence[SubtermNode], 'All nodes in the graph']
with_nodes(nodes)

Bases: object

SubtermLinkEdge | SubtermLinkProperty | SubtermLinkAttribute

ATTRIBUTE = Name(value='attribute')
EDGE = Name(value='edge')
PROPERTY = Name(value='property')
TYPE_ = Name(value='hydra.paths.SubtermLink')
class hydra.paths.SubtermLinkAttribute(value: T)

Bases: Node[SubtermAttribute]

A non-term attribute of a position

class hydra.paths.SubtermLinkEdge(value: T)

Bases: Node[SubtermEdge]

A reference to another binding of the graph

class hydra.paths.SubtermLinkProperty(value: T)

Bases: Node[SubtermProperty]

A leaf term

class hydra.paths.SubtermNode(name: Annotated[Name, 'The name of the binding'], type: Annotated[TypeScheme, 'The type scheme of the binding'], links: Annotated[Sequence[SubtermLink], 'The outgoing links of the node'])

Bases: object

A node in a subterm graph: a binding of the graph, with its type scheme and outgoing links.

class Builder(_name: 'hydra.core.Name' = None, _type: 'hydra.core.TypeScheme' = None, _links: 'Sequence[SubtermLink]' = None)

Bases: object

build()
name(name)
type(type)
NAME = Name(value='name')
TYPE = Name(value='type')
TYPE_ = Name(value='hydra.paths.SubtermNode')
static builder()
name: Annotated[Name, 'The name of the binding']
type: Annotated[TypeScheme, 'The type scheme of the binding']
with_name(name)
with_type(type)
class hydra.paths.SubtermPath(value: T)

Bases: Node[Sequence[SubtermStep]]

A sequence of subterm steps forming a path through a term, root first.

TYPE_ = Name(value='hydra.paths.SubtermPath')
class hydra.paths.SubtermProperty(path: Annotated[SubtermPath, 'The subterm path at which the leaf term occurs'], target: Annotated[Term, 'The leaf term'])

Bases: object

A link from a node to a leaf term (literal, unit, projection, unwrap, or an unbound variable).

class Builder(_path: 'SubtermPath' = None, _target: 'hydra.core.Term' = None)

Bases: object

build()
path(path)
target(target)
PATH = Name(value='path')
TARGET = Name(value='target')
TYPE_ = Name(value='hydra.paths.SubtermProperty')
static builder()
path: Annotated[SubtermPath, 'The subterm path at which the leaf term occurs']
target: Annotated[Term, 'The leaf term']
with_path(path)
with_target(target)
class hydra.paths.SubtermStep

Bases: object

SubtermStepAnnotatedAnnotation | SubtermStepAnnotatedBody | SubtermStepApplicationArgument | SubtermStepApplicationFunction | SubtermStepCasesCase | SubtermStepCasesDefault | SubtermStepEitherLeft | SubtermStepEitherRight | SubtermStepInjectField | SubtermStepLambdaBody | SubtermStepLetBinding | SubtermStepLetBody | SubtermStepListElement | SubtermStepMapKey | SubtermStepMapValue | SubtermStepOptionalGiven | SubtermStepPairFirst | SubtermStepPairSecond | SubtermStepRecordField | SubtermStepSetElement | SubtermStepTypeApplicationBody | SubtermStepTypeLambdaBody | SubtermStepWrapBody

ANNOTATED_ANNOTATION = Name(value='annotatedAnnotation')
ANNOTATED_BODY = Name(value='annotatedBody')
APPLICATION_ARGUMENT = Name(value='applicationArgument')
APPLICATION_FUNCTION = Name(value='applicationFunction')
CASES_CASE = Name(value='casesCase')
CASES_DEFAULT = Name(value='casesDefault')
EITHER_LEFT = Name(value='eitherLeft')
EITHER_RIGHT = Name(value='eitherRight')
INJECT_FIELD = Name(value='injectField')
LAMBDA_BODY = Name(value='lambdaBody')
LET_BINDING = Name(value='letBinding')
LET_BODY = Name(value='letBody')
LIST_ELEMENT = Name(value='listElement')
MAP_KEY = Name(value='mapKey')
MAP_VALUE = Name(value='mapValue')
OPTIONAL_GIVEN = Name(value='optionalGiven')
PAIR_FIRST = Name(value='pairFirst')
PAIR_SECOND = Name(value='pairSecond')
RECORD_FIELD = Name(value='recordField')
SET_ELEMENT = Name(value='setElement')
TYPE_ = Name(value='hydra.paths.SubtermStep')
TYPE_APPLICATION_BODY = Name(value='typeApplicationBody')
TYPE_LAMBDA_BODY = Name(value='typeLambdaBody')
WRAP_BODY = Name(value='wrapBody')
class hydra.paths.SubtermStepAnnotatedAnnotation

Bases: object

Access the annotation of an annotated term

class hydra.paths.SubtermStepAnnotatedBody

Bases: object

Access the body of an annotated term

class hydra.paths.SubtermStepApplicationArgument

Bases: object

Access the argument of an application term

class hydra.paths.SubtermStepApplicationFunction

Bases: object

Access the function of an application term

class hydra.paths.SubtermStepCasesCase(value: T)

Bases: Node[hydra.core.Name]

Access the handler of a specific case of a case statement by field name

class hydra.paths.SubtermStepCasesDefault

Bases: object

Access the default case of a case statement

class hydra.paths.SubtermStepEitherLeft

Bases: object

Access the left term of an either value

class hydra.paths.SubtermStepEitherRight

Bases: object

Access the right term of an either value

class hydra.paths.SubtermStepInjectField(value: T)

Bases: Node[hydra.core.Name]

Access the injected term of a union injection by field name

class hydra.paths.SubtermStepLambdaBody

Bases: object

Access the body of a lambda term

class hydra.paths.SubtermStepLetBinding(value: T)

Bases: Node[hydra.core.Name]

Access a specific binding in a let term by variable name

class hydra.paths.SubtermStepLetBody

Bases: object

Access the body of a let term

class hydra.paths.SubtermStepListElement(value: T)

Bases: Node[int]

Access an element of a list by index

class hydra.paths.SubtermStepMapKey(value: T)

Bases: Node[int]

Access the key of the map entry at the given index

class hydra.paths.SubtermStepMapValue(value: T)

Bases: Node[int]

Access the value of the map entry at the given index

class hydra.paths.SubtermStepOptionalGiven

Bases: object

Access the term inside a given (present) optional value

class hydra.paths.SubtermStepPairFirst

Bases: object

Access the first term of a pair

class hydra.paths.SubtermStepPairSecond

Bases: object

Access the second term of a pair

class hydra.paths.SubtermStepRecordField(value: T)

Bases: Node[hydra.core.Name]

Access a field of a record by field name

class hydra.paths.SubtermStepSetElement(value: T)

Bases: Node[int]

Access an element of a set by index

class hydra.paths.SubtermStepTypeApplicationBody

Bases: object

Access the body of a type application term

class hydra.paths.SubtermStepTypeLambdaBody

Bases: object

Access the body of a type lambda term

class hydra.paths.SubtermStepWrapBody

Bases: object

Access the body of a wrapped term

class hydra.paths.SubtypeAttribute(path: Annotated[SubtypePath, 'The subtype path at which the attribute occurs'], target: Annotated[TypeAttribute, 'The attribute value'])

Bases: object

A link from a node to a non-type attribute of a position.

class Builder(_path: 'SubtypePath' = None, _target: 'TypeAttribute' = None)

Bases: object

build()
path(path)
target(target)
PATH = Name(value='path')
TARGET = Name(value='target')
TYPE_ = Name(value='hydra.paths.SubtypeAttribute')
static builder()
path: Annotated[SubtypePath, 'The subtype path at which the attribute occurs']
target: Annotated[TypeAttribute, 'The attribute value']
with_path(path)
with_target(target)
class hydra.paths.SubtypeEdge(path: Annotated[SubtypePath, 'The subtype path at which the reference occurs'], target: Annotated[Name, 'The name of the referenced type'])

Bases: object

A link from a node to a named type, addressed by the path at which it occurs.

class Builder(_path: 'SubtypePath' = None, _target: 'hydra.core.Name' = None)

Bases: object

build()
path(path)
target(target)
PATH = Name(value='path')
TARGET = Name(value='target')
TYPE_ = Name(value='hydra.paths.SubtypeEdge')
static builder()
path: Annotated[SubtypePath, 'The subtype path at which the reference occurs']
target: Annotated[Name, 'The name of the referenced type']
with_path(path)
with_target(target)
class hydra.paths.SubtypeGraph(nodes: Annotated[Sequence[SubtypeNode], 'All nodes in the graph'])

Bases: object

The link view of a schema as subtype nodes and their links.

class Builder(_nodes: 'Sequence[SubtypeNode]' = None)

Bases: object

build()
nodes(nodes)
NODES = Name(value='nodes')
TYPE_ = Name(value='hydra.paths.SubtypeGraph')
static builder()
nodes: Annotated[Sequence[SubtypeNode], 'All nodes in the graph']
with_nodes(nodes)

Bases: object

SubtypeLinkEdge | SubtypeLinkProperty | SubtypeLinkAttribute

ATTRIBUTE = Name(value='attribute')
EDGE = Name(value='edge')
PROPERTY = Name(value='property')
TYPE_ = Name(value='hydra.paths.SubtypeLink')
class hydra.paths.SubtypeLinkAttribute(value: T)

Bases: Node[SubtypeAttribute]

A non-type attribute of a position

class hydra.paths.SubtypeLinkEdge(value: T)

Bases: Node[SubtypeEdge]

A reference to a named type

class hydra.paths.SubtypeLinkProperty(value: T)

Bases: Node[SubtypeProperty]

A leaf type

class hydra.paths.SubtypeNode(name: Annotated[Name, 'The name of the type'], links: Annotated[Sequence[SubtypeLink], 'The outgoing links of the node'])

Bases: object

A node in a subtype graph: a named type, with its outgoing links.

class Builder(_name: 'hydra.core.Name' = None, _links: 'Sequence[SubtypeLink]' = None)

Bases: object

build()
name(name)
NAME = Name(value='name')
TYPE_ = Name(value='hydra.paths.SubtypeNode')
static builder()
name: Annotated[Name, 'The name of the type']
with_name(name)
class hydra.paths.SubtypePath(value: T)

Bases: Node[Sequence[SubtypeStep]]

A sequence of subtype steps forming a path through a type, root first.

TYPE_ = Name(value='hydra.paths.SubtypePath')
class hydra.paths.SubtypeProperty(path: Annotated[SubtypePath, 'The subtype path at which the leaf type occurs'], target: Annotated[Type, 'The leaf type'])

Bases: object

A link from a node to a leaf type (literal, unit, void, or a bound variable).

class Builder(_path: 'SubtypePath' = None, _target: 'hydra.core.Type' = None)

Bases: object

build()
path(path)
target(target)
PATH = Name(value='path')
TARGET = Name(value='target')
TYPE_ = Name(value='hydra.paths.SubtypeProperty')
static builder()
path: Annotated[SubtypePath, 'The subtype path at which the leaf type occurs']
target: Annotated[Type, 'The leaf type']
with_path(path)
with_target(target)
class hydra.paths.SubtypeStep

Bases: object

SubtypeStepAnnotatedBody | SubtypeStepApplicationArgument | SubtypeStepApplicationFunction | SubtypeStepEffectValue | SubtypeStepEitherLeft | SubtypeStepEitherRight | SubtypeStepForallBody | SubtypeStepFunctionCodomain | SubtypeStepFunctionDomain | SubtypeStepListElement | SubtypeStepMapKeys | SubtypeStepMapValues | SubtypeStepOptionalElement | SubtypeStepPairFirst | SubtypeStepPairSecond | SubtypeStepRecordField | SubtypeStepSetElement | SubtypeStepUnionField | SubtypeStepWrapBody

ANNOTATED_BODY = Name(value='annotatedBody')
APPLICATION_ARGUMENT = Name(value='applicationArgument')
APPLICATION_FUNCTION = Name(value='applicationFunction')
EFFECT_VALUE = Name(value='effectValue')
EITHER_LEFT = Name(value='eitherLeft')
EITHER_RIGHT = Name(value='eitherRight')
FORALL_BODY = Name(value='forallBody')
FUNCTION_CODOMAIN = Name(value='functionCodomain')
FUNCTION_DOMAIN = Name(value='functionDomain')
LIST_ELEMENT = Name(value='listElement')
MAP_KEYS = Name(value='mapKeys')
MAP_VALUES = Name(value='mapValues')
OPTIONAL_ELEMENT = Name(value='optionalElement')
PAIR_FIRST = Name(value='pairFirst')
PAIR_SECOND = Name(value='pairSecond')
RECORD_FIELD = Name(value='recordField')
SET_ELEMENT = Name(value='setElement')
TYPE_ = Name(value='hydra.paths.SubtypeStep')
UNION_FIELD = Name(value='unionField')
WRAP_BODY = Name(value='wrapBody')
class hydra.paths.SubtypeStepAnnotatedBody

Bases: object

Access the body of an annotated type (the annotation is a term; there is no step for it)

class hydra.paths.SubtypeStepApplicationArgument

Bases: object

Access the argument of an application type

class hydra.paths.SubtypeStepApplicationFunction

Bases: object

Access the function of an application type

class hydra.paths.SubtypeStepEffectValue

Bases: object

Access the value type of an effect type

class hydra.paths.SubtypeStepEitherLeft

Bases: object

Access the left type of an either type

class hydra.paths.SubtypeStepEitherRight

Bases: object

Access the right type of an either type

class hydra.paths.SubtypeStepForallBody

Bases: object

Access the body of a universally quantified type

class hydra.paths.SubtypeStepFunctionCodomain

Bases: object

Access the codomain type of a function type

class hydra.paths.SubtypeStepFunctionDomain

Bases: object

Access the domain type of a function type

class hydra.paths.SubtypeStepListElement

Bases: object

Access the element type of a list type

class hydra.paths.SubtypeStepMapKeys

Bases: object

Access the key type of a map type

class hydra.paths.SubtypeStepMapValues

Bases: object

Access the value type of a map type

class hydra.paths.SubtypeStepOptionalElement

Bases: object

Access the element type of an optional type

class hydra.paths.SubtypeStepPairFirst

Bases: object

Access the first type of a pair type

class hydra.paths.SubtypeStepPairSecond

Bases: object

Access the second type of a pair type

class hydra.paths.SubtypeStepRecordField(value: T)

Bases: Node[hydra.core.Name]

Access a field type of a record type by field name

class hydra.paths.SubtypeStepSetElement

Bases: object

Access the element type of a set type

class hydra.paths.SubtypeStepUnionField(value: T)

Bases: Node[hydra.core.Name]

Access a field type of a union type by field name

class hydra.paths.SubtypeStepWrapBody

Bases: object

Access the body type of a wrapped type

class hydra.paths.TermAttribute

Bases: object

TermAttributeCasesTypeName | TermAttributeInjectTypeName | TermAttributeLambdaDomainGiven | TermAttributeLambdaParameter | TermAttributeLetBindingTypeSchemeGiven | TermAttributeProjectFieldName | TermAttributeProjectTypeName | TermAttributeRecordTypeName | TermAttributeTypeApplicationType | TermAttributeTypeLambdaParameter | TermAttributeWrapTypeName

CASES_TYPE_NAME = Name(value='casesTypeName')
INJECT_TYPE_NAME = Name(value='injectTypeName')
LAMBDA_DOMAIN_GIVEN = Name(value='lambdaDomainGiven')
LAMBDA_PARAMETER = Name(value='lambdaParameter')
LET_BINDING_TYPE_SCHEME_GIVEN = Name(value='letBindingTypeSchemeGiven')
PROJECT_FIELD_NAME = Name(value='projectFieldName')
PROJECT_TYPE_NAME = Name(value='projectTypeName')
RECORD_TYPE_NAME = Name(value='recordTypeName')
TYPE_ = Name(value='hydra.paths.TermAttribute')
TYPE_APPLICATION_TYPE = Name(value='typeApplicationType')
TYPE_LAMBDA_PARAMETER = Name(value='typeLambdaParameter')
WRAP_TYPE_NAME = Name(value='wrapTypeName')
class hydra.paths.TermAttributeCasesTypeName(value: T)

Bases: Node[hydra.core.Name]

The name of the union type eliminated by a case statement

class hydra.paths.TermAttributeInjectTypeName(value: T)

Bases: Node[hydra.core.Name]

The name of the union type of an injection

class hydra.paths.TermAttributeLambdaDomainGiven(value: T)

Bases: Node[hydra.core.Type]

The (given) domain type of a lambda

class hydra.paths.TermAttributeLambdaParameter(value: T)

Bases: Node[hydra.core.Name]

The parameter name of a lambda

class hydra.paths.TermAttributeLetBindingTypeSchemeGiven(value: T)

Bases: Node[tuple[hydra.core.Name, hydra.core.TypeScheme]]

The name of a let binding together with its (given) type scheme

class hydra.paths.TermAttributeProjectFieldName(value: T)

Bases: Node[hydra.core.Name]

The name of the field projected by a projection

class hydra.paths.TermAttributeProjectTypeName(value: T)

Bases: Node[hydra.core.Name]

The name of the record type of a projection

class hydra.paths.TermAttributeRecordTypeName(value: T)

Bases: Node[hydra.core.Name]

The name of the record type of a record term

class hydra.paths.TermAttributeTypeApplicationType(value: T)

Bases: Node[hydra.core.Type]

The type argument of a type application term

class hydra.paths.TermAttributeTypeLambdaParameter(value: T)

Bases: Node[hydra.core.Name]

The type-variable parameter of a type lambda term

class hydra.paths.TermAttributeWrapTypeName(value: T)

Bases: Node[hydra.core.Name]

The name of the wrapper type of a wrapped term

class hydra.paths.TypeAttribute

Bases: object

TypeAttributeAnnotatedAnnotation | TypeAttributeForallParameter

ANNOTATED_ANNOTATION = Name(value='annotatedAnnotation')
FORALL_PARAMETER = Name(value='forallParameter')
TYPE_ = Name(value='hydra.paths.TypeAttribute')
class hydra.paths.TypeAttributeAnnotatedAnnotation(value: T)

Bases: Node[hydra.core.Term]

The annotation of an annotated type (a term; not descended into)

class hydra.paths.TypeAttributeForallParameter(value: T)

Bases: Node[hydra.core.Name]

The type-variable parameter of a universally quantified type