hydra.core module

Hydra’s core data model, consisting of the fundamental hydra.core.Term type and all of its dependencies.

class hydra.core.AnnotatedTerm(body: Annotated[Term, 'The term being annotated'], annotation: Annotated[Term, 'The annotation as a single term. By convention this is a map term (Name -> Term) so that multiple independent annotations can coexist, but applications are free to use any term shape.'])

Bases: object

A term together with an annotation.

ANNOTATION = Name(value='annotation')
BODY = Name(value='body')
class Builder(_body: 'Term' = None, _annotation: 'Term' = None)

Bases: object

annotation(annotation)
body(body)
build()
TYPE_ = Name(value='hydra.core.AnnotatedTerm')
annotation: Annotated[Term, 'The annotation as a single term. By convention this is a map term (Name -> Term) so that multiple independent annotations can coexist, but applications are free to use any term shape.']
body: Annotated[Term, 'The term being annotated']
static builder()
with_annotation(annotation)
with_body(body)
class hydra.core.AnnotatedType(body: Annotated[Type, 'The type being annotated'], annotation: Annotated[Term, 'The annotation as a single term. By convention this is a map term (Name -> Term) so that multiple independent annotations can coexist, but applications are free to use any term shape.'])

Bases: object

A type together with an annotation.

ANNOTATION = Name(value='annotation')
BODY = Name(value='body')
class Builder(_body: 'Type' = None, _annotation: 'Term' = None)

Bases: object

annotation(annotation)
body(body)
build()
TYPE_ = Name(value='hydra.core.AnnotatedType')
annotation: Annotated[Term, 'The annotation as a single term. By convention this is a map term (Name -> Term) so that multiple independent annotations can coexist, but applications are free to use any term shape.']
body: Annotated[Type, 'The type being annotated']
static builder()
with_annotation(annotation)
with_body(body)
class hydra.core.Application(function: Annotated[Term, 'The left-hand side of the application'], argument: Annotated[Term, 'The right-hand side of the application'])

Bases: object

A term which applies a function to an argument.

ARGUMENT = Name(value='argument')
class Builder(_function: 'Term' = None, _argument: 'Term' = None)

Bases: object

argument(argument)
build()
function(function)
FUNCTION = Name(value='function')
TYPE_ = Name(value='hydra.core.Application')
argument: Annotated[Term, 'The right-hand side of the application']
static builder()
function: Annotated[Term, 'The left-hand side of the application']
with_argument(argument)
with_function(function)
class hydra.core.ApplicationType(function: Annotated[Type, 'The left-hand side of the application'], argument: Annotated[Type, 'The right-hand side of the application'])

Bases: object

The type-level analog of an application term.

ARGUMENT = Name(value='argument')
class Builder(_function: 'Type' = None, _argument: 'Type' = None)

Bases: object

argument(argument)
build()
function(function)
FUNCTION = Name(value='function')
TYPE_ = Name(value='hydra.core.ApplicationType')
argument: Annotated[Type, 'The right-hand side of the application']
static builder()
function: Annotated[Type, 'The left-hand side of the application']
with_argument(argument)
with_function(function)
class hydra.core.Binding(name: Annotated[Name, 'The name of the bound variable'], term: Annotated[Term, 'The term to which the variable is bound'], type_scheme: Annotated[object, 'The optional type scheme of the bound term'])

Bases: object

A field with an optional type scheme, used to bind variables to terms in a ‘let’ expression.

class Builder(_name: 'Name' = None, _term: 'Term' = None, _type_scheme: 'Optional[TypeScheme]' = None)

Bases: object

build()
name(name)
term(term)
type_scheme(type_scheme)
NAME = Name(value='name')
TERM = Name(value='term')
TYPE_ = Name(value='hydra.core.Binding')
TYPE_SCHEME = Name(value='typeScheme')
static builder()
name: Annotated[Name, 'The name of the bound variable']
term: Annotated[Term, 'The term to which the variable is bound']
type_scheme: Annotated[object, 'The optional type scheme of the bound term']
with_name(name)
with_term(term)
with_type_scheme(type_scheme)
class hydra.core.CaseAlternative(name: Annotated[Name, 'The name of the union variant matched by this alternative'], handler: Annotated[Term, "The handler applied to the matched variant's payload"])

Bases: object

A single alternative of a case statement (union elimination): the variant being matched, together with the term that handles it.

class Builder(_name: 'Name' = None, _handler: 'Term' = None)

Bases: object

build()
handler(handler)
name(name)
HANDLER = Name(value='handler')
NAME = Name(value='name')
TYPE_ = Name(value='hydra.core.CaseAlternative')
static builder()
handler: Annotated[Term, "The handler applied to the matched variant's payload"]
name: Annotated[Name, 'The name of the union variant matched by this alternative']
with_handler(handler)
with_name(name)
class hydra.core.CaseStatement(type_name: Annotated[Name, 'The name of the union type'], default: Annotated[object, 'An optional default case, used if none of the explicit cases match'], cases: Annotated[Sequence[CaseAlternative], 'A list of case alternatives, one per union variant being handled'])

Bases: object

A union elimination; a case statement.

class Builder(_type_name: 'Name' = None, _default: 'Optional[Term]' = None, _cases: 'Sequence[CaseAlternative]' = None)

Bases: object

build()
cases(cases)
default(default)
type_name(type_name)
CASES = Name(value='cases')
DEFAULT = Name(value='default')
TYPE_ = Name(value='hydra.core.CaseStatement')
TYPE_NAME = Name(value='typeName')
static builder()
cases: Annotated[Sequence[CaseAlternative], 'A list of case alternatives, one per union variant being handled']
default: Annotated[object, 'An optional default case, used if none of the explicit cases match']
type_name: Annotated[Name, 'The name of the union type']
with_cases(cases)
with_default(default)
with_type_name(type_name)
class hydra.core.EitherType(left: Annotated[Type, "The 'left' alternative"], right: Annotated[Type, "The 'right' alternative"])

Bases: object

A type which provides a choice between a ‘left’ type and a ‘right’ type.

class Builder(_left: 'Type' = None, _right: 'Type' = None)

Bases: object

build()
left(left)
right(right)
LEFT = Name(value='left')
RIGHT = Name(value='right')
TYPE_ = Name(value='hydra.core.EitherType')
static builder()
left: Annotated[Type, "The 'left' alternative"]
right: Annotated[Type, "The 'right' alternative"]
with_left(left)
with_right(right)
class hydra.core.Field(name: Annotated[Name, 'The name of the field'], term: Annotated[Term, 'The value of the field'])

Bases: object

A name/term pair.

class Builder(_name: 'Name' = None, _term: 'Term' = None)

Bases: object

build()
name(name)
term(term)
NAME = Name(value='name')
TERM = Name(value='term')
TYPE_ = Name(value='hydra.core.Field')
static builder()
name: Annotated[Name, 'The name of the field']
term: Annotated[Term, 'The value of the field']
with_name(name)
with_term(term)
class hydra.core.FieldType(name: Annotated[Name, 'The name of the field'], type: Annotated[Type, 'The type of the field'])

Bases: object

A name/type pair.

class Builder(_name: 'Name' = None, _type: 'Type' = None)

Bases: object

build()
name(name)
type(type)
NAME = Name(value='name')
TYPE = Name(value='type')
TYPE_ = Name(value='hydra.core.FieldType')
static builder()
name: Annotated[Name, 'The name of the field']
type: Annotated[Type, 'The type of the field']
with_name(name)
with_type(type)
class hydra.core.FloatType(*values)

Bases: Enum

A floating-point type.

FLOAT32 = Name(value='float32')

A 32-bit floating-point type

FLOAT64 = Name(value='float64')

A 64-bit floating-point type

TYPE_ = Name(value='hydra.core.FloatType')
class hydra.core.FloatValue

Bases: object

FloatValueFloat32 | FloatValueFloat64

FLOAT32 = Name(value='float32')
FLOAT64 = Name(value='float64')
TYPE_ = Name(value='hydra.core.FloatValue')
class hydra.core.FloatValueFloat32(value: T)

Bases: Node[float]

A 32-bit floating-point value

class hydra.core.FloatValueFloat64(value: T)

Bases: Node[float]

A 64-bit floating-point value

class hydra.core.ForallType(parameter: Annotated[Name, 'The variable which is bound by the lambda'], body: Annotated[Type, 'The body of the lambda'])

Bases: object

A universally quantified type; the System F equivalent of a type scheme, and the type-level equivalent of a lambda term.

BODY = Name(value='body')
class Builder(_parameter: 'Name' = None, _body: 'Type' = None)

Bases: object

body(body)
build()
parameter(parameter)
PARAMETER = Name(value='parameter')
TYPE_ = Name(value='hydra.core.ForallType')
body: Annotated[Type, 'The body of the lambda']
static builder()
parameter: Annotated[Name, 'The variable which is bound by the lambda']
with_body(body)
with_parameter(parameter)
class hydra.core.FunctionType(domain: Annotated[Type, 'The domain (input) type of the function'], codomain: Annotated[Type, 'The codomain (output) type of the function'])

Bases: object

A function type, also known as an arrow type.

class Builder(_domain: 'Type' = None, _codomain: 'Type' = None)

Bases: object

build()
codomain(codomain)
domain(domain)
CODOMAIN = Name(value='codomain')
DOMAIN = Name(value='domain')
TYPE_ = Name(value='hydra.core.FunctionType')
static builder()
codomain: Annotated[Type, 'The codomain (output) type of the function']
domain: Annotated[Type, 'The domain (input) type of the function']
with_codomain(codomain)
with_domain(domain)
class hydra.core.Injection(type_name: Annotated[Name, 'The name of the union type'], field: Annotated[Field, 'The field being injected, including its name and value'])

Bases: object

An instance of a union type; i.e. a string-indexed generalization of inl() or inr().

class Builder(_type_name: 'Name' = None, _field: 'Field' = None)

Bases: object

build()
field(field)
type_name(type_name)
FIELD = Name(value='field')
TYPE_ = Name(value='hydra.core.Injection')
TYPE_NAME = Name(value='typeName')
static builder()
field: Annotated[Field, 'The field being injected, including its name and value']
type_name: Annotated[Name, 'The name of the union type']
with_field(field)
with_type_name(type_name)
class hydra.core.IntegerType(*values)

Bases: Enum

An integer type.

BIGINT = Name(value='bigint')

An arbitrary-precision integer type

INT16 = Name(value='int16')

A 16-bit signed integer type

INT32 = Name(value='int32')

A 32-bit signed integer type

INT64 = Name(value='int64')

A 64-bit signed integer type

INT8 = Name(value='int8')

An 8-bit signed integer type

TYPE_ = Name(value='hydra.core.IntegerType')
UINT16 = Name(value='uint16')

A 16-bit unsigned integer type

UINT32 = Name(value='uint32')

A 32-bit unsigned integer type

UINT64 = Name(value='uint64')

A 64-bit unsigned integer type

UINT8 = Name(value='uint8')

An 8-bit unsigned integer type

class hydra.core.IntegerValue

Bases: object

IntegerValueBigint | IntegerValueInt8 | IntegerValueInt16 | IntegerValueInt32 | IntegerValueInt64 | IntegerValueUint8 | IntegerValueUint16 | IntegerValueUint32 | IntegerValueUint64

BIGINT = Name(value='bigint')
INT16 = Name(value='int16')
INT32 = Name(value='int32')
INT64 = Name(value='int64')
INT8 = Name(value='int8')
TYPE_ = Name(value='hydra.core.IntegerValue')
UINT16 = Name(value='uint16')
UINT32 = Name(value='uint32')
UINT64 = Name(value='uint64')
UINT8 = Name(value='uint8')
class hydra.core.IntegerValueBigint(value: T)

Bases: Node[int]

An arbitrary-precision integer value

class hydra.core.IntegerValueInt16(value: T)

Bases: Node[int]

A 16-bit signed integer value (short value)

class hydra.core.IntegerValueInt32(value: T)

Bases: Node[int]

A 32-bit signed integer value (int value)

class hydra.core.IntegerValueInt64(value: T)

Bases: Node[int]

A 64-bit signed integer value (long value)

class hydra.core.IntegerValueInt8(value: T)

Bases: Node[int]

An 8-bit signed integer value

class hydra.core.IntegerValueUint16(value: T)

Bases: Node[int]

A 16-bit unsigned integer value

class hydra.core.IntegerValueUint32(value: T)

Bases: Node[int]

A 32-bit unsigned integer value (unsigned int)

class hydra.core.IntegerValueUint64(value: T)

Bases: Node[int]

A 64-bit unsigned integer value (unsigned long)

class hydra.core.IntegerValueUint8(value: T)

Bases: Node[int]

An 8-bit unsigned integer value (byte)

class hydra.core.Lambda(parameter: Annotated[Name, 'The parameter of the lambda'], domain: Annotated[object, 'An optional domain type for the lambda'], body: Annotated[Term, 'The body of the lambda'])

Bases: object

A function abstraction (lambda).

BODY = Name(value='body')
class Builder(_parameter: 'Name' = None, _domain: 'Optional[Type]' = None, _body: 'Term' = None)

Bases: object

body(body)
build()
domain(domain)
parameter(parameter)
DOMAIN = Name(value='domain')
PARAMETER = Name(value='parameter')
TYPE_ = Name(value='hydra.core.Lambda')
body: Annotated[Term, 'The body of the lambda']
static builder()
domain: Annotated[object, 'An optional domain type for the lambda']
parameter: Annotated[Name, 'The parameter of the lambda']
with_body(body)
with_domain(domain)
with_parameter(parameter)
class hydra.core.Let(bindings: Annotated[Sequence[Binding], 'The list of variable bindings'], body: Annotated[Term, 'The body term in which the variables are bound'])

Bases: object

A set of (possibly recursive) ‘let’ bindings together with a body in which they are bound.

BINDINGS = Name(value='bindings')
BODY = Name(value='body')
class Builder(_bindings: 'Sequence[Binding]' = None, _body: 'Term' = None)

Bases: object

bindings(bindings)
body(body)
build()
TYPE_ = Name(value='hydra.core.Let')
bindings: Annotated[Sequence[Binding], 'The list of variable bindings']
body: Annotated[Term, 'The body term in which the variables are bound']
static builder()
with_bindings(bindings)
with_body(body)
class hydra.core.Literal

Bases: object

LiteralBinary | LiteralBoolean | LiteralDecimal | LiteralFloat | LiteralInteger | LiteralString

BINARY = Name(value='binary')
BOOLEAN = Name(value='boolean')
DECIMAL = Name(value='decimal')
FLOAT = Name(value='float')
INTEGER = Name(value='integer')
STRING = Name(value='string')
TYPE_ = Name(value='hydra.core.Literal')
class hydra.core.LiteralBinary(value: T)

Bases: Node[bytes]

A binary literal

class hydra.core.LiteralBoolean(value: T)

Bases: Node[bool]

A boolean literal

class hydra.core.LiteralDecimal(value: T)

Bases: Node[Decimal]

An arbitrary-precision decimal literal

class hydra.core.LiteralFloat(value: T)

Bases: Node[FloatValue]

A floating-point literal

class hydra.core.LiteralInteger(value: T)

Bases: Node[IntegerValue]

An integer literal

class hydra.core.LiteralString(value: T)

Bases: Node[str]

A string literal

class hydra.core.LiteralType

Bases: object

LiteralTypeBinary | LiteralTypeBoolean | LiteralTypeDecimal | LiteralTypeFloat | LiteralTypeInteger | LiteralTypeString

BINARY = Name(value='binary')
BOOLEAN = Name(value='boolean')
DECIMAL = Name(value='decimal')
FLOAT = Name(value='float')
INTEGER = Name(value='integer')
STRING = Name(value='string')
TYPE_ = Name(value='hydra.core.LiteralType')
class hydra.core.LiteralTypeBinary

Bases: object

The type of a binary (byte string) value

class hydra.core.LiteralTypeBoolean

Bases: object

The type of a boolean (true/false) value

class hydra.core.LiteralTypeDecimal

Bases: object

The type of an arbitrary-precision decimal value

class hydra.core.LiteralTypeFloat(value: T)

Bases: Node[FloatType]

The type of a floating-point value

class hydra.core.LiteralTypeInteger(value: T)

Bases: Node[IntegerType]

The type of an integer value

class hydra.core.LiteralTypeString

Bases: object

The type of a string value

class hydra.core.MapType(keys: Annotated[Type, 'The type of keys in the map'], values: Annotated[Type, 'The type of values in the map'])

Bases: object

A map type.

class Builder(_keys: 'Type' = None, _values: 'Type' = None)

Bases: object

build()
keys(keys)
values(values)
KEYS = Name(value='keys')
TYPE_ = Name(value='hydra.core.MapType')
VALUES = Name(value='values')
static builder()
keys: Annotated[Type, 'The type of keys in the map']
values: Annotated[Type, 'The type of values in the map']
with_keys(keys)
with_values(values)
class hydra.core.Name(value: T)

Bases: Node[str]

A unique identifier in some context; a string-valued key.

TYPE_ = Name(value='hydra.core.Name')
class hydra.core.PairType(first: Annotated[Type, 'The first component of the pair'], second: Annotated[Type, 'The second component of the pair'])

Bases: object

A type which pairs a ‘first’ type and a ‘second’ type.

class Builder(_first: 'Type' = None, _second: 'Type' = None)

Bases: object

build()
first(first)
second(second)
FIRST = Name(value='first')
SECOND = Name(value='second')
TYPE_ = Name(value='hydra.core.PairType')
static builder()
first: Annotated[Type, 'The first component of the pair']
second: Annotated[Type, 'The second component of the pair']
with_first(first)
with_second(second)
class hydra.core.Projection(type_name: Annotated[Name, 'The name of the record type'], field_name: Annotated[Name, 'The name of the projected field'])

Bases: object

A record elimination; a projection.

class Builder(_type_name: 'Name' = None, _field_name: 'Name' = None)

Bases: object

build()
field_name(field_name)
type_name(type_name)
FIELD_NAME = Name(value='fieldName')
TYPE_ = Name(value='hydra.core.Projection')
TYPE_NAME = Name(value='typeName')
static builder()
field_name: Annotated[Name, 'The name of the projected field']
type_name: Annotated[Name, 'The name of the record type']
with_field_name(field_name)
with_type_name(type_name)
class hydra.core.Record(type_name: Annotated[Name, 'The name of the record type'], fields: Annotated[Sequence[Field], 'The fields of the record, as a list of name/term pairs'])

Bases: object

A record, or labeled tuple; a map of field names to terms.

class Builder(_type_name: 'Name' = None, _fields: 'Sequence[Field]' = None)

Bases: object

build()
fields(fields)
type_name(type_name)
FIELDS = Name(value='fields')
TYPE_ = Name(value='hydra.core.Record')
TYPE_NAME = Name(value='typeName')
static builder()
fields: Annotated[Sequence[Field], 'The fields of the record, as a list of name/term pairs']
type_name: Annotated[Name, 'The name of the record type']
with_fields(fields)
with_type_name(type_name)
class hydra.core.Term

Bases: object

TermAnnotated | TermApplication | TermCases | TermEither | TermInject | TermLambda | TermLet | TermList | TermLiteral | TermMap | TermOptional | TermPair | TermProject | TermRecord | TermSet | TermTypeApplication | TermTypeLambda | TermUnit | TermUnwrap | TermVariable | TermWrap

ANNOTATED = Name(value='annotated')
APPLICATION = Name(value='application')
CASES = Name(value='cases')
EITHER = Name(value='either')
INJECT = Name(value='inject')
LAMBDA = Name(value='lambda')
LET = Name(value='let')
LIST = Name(value='list')
LITERAL = Name(value='literal')
MAP = Name(value='map')
OPTIONAL = Name(value='optional')
PAIR = Name(value='pair')
PROJECT = Name(value='project')
RECORD = Name(value='record')
SET = Name(value='set')
TYPE_ = Name(value='hydra.core.Term')
TYPE_APPLICATION = Name(value='typeApplication')
TYPE_LAMBDA = Name(value='typeLambda')
UNIT = Name(value='unit')
UNWRAP = Name(value='unwrap')
VARIABLE = Name(value='variable')
WRAP = Name(value='wrap')
class hydra.core.TermAnnotated(value: T)

Bases: Node[AnnotatedTerm]

A term annotated with metadata

class hydra.core.TermApplication(value: T)

Bases: Node[Application]

A function application

class hydra.core.TermCases(value: T)

Bases: Node[CaseStatement]

A union elimination; a case statement

class hydra.core.TermEither(value: T)

Bases: Node[Either[Term, Term]]

An either value

class hydra.core.TermInject(value: T)

Bases: Node[Injection]

An injection; an instance of a union type

class hydra.core.TermLambda(value: T)

Bases: Node[Lambda]

A function abstraction (lambda)

class hydra.core.TermLet(value: T)

Bases: Node[Let]

A ‘let’ term, which binds variables to terms

class hydra.core.TermList(value: T)

Bases: Node[Sequence[Term]]

A list

class hydra.core.TermLiteral(value: T)

Bases: Node[Literal]

A literal value

class hydra.core.TermMap(value: T)

Bases: Node[Mapping[Term, Term]]

A map of keys to values

class hydra.core.TermOptional(value: T)

Bases: Node[Optional[Term]]

An optional value

class hydra.core.TermPair(value: T)

Bases: Node[tuple[Term, Term]]

A pair (2-tuple)

class hydra.core.TermProject(value: T)

Bases: Node[Projection]

A record elimination; a projection

class hydra.core.TermRecord(value: T)

Bases: Node[Record]

A record term

class hydra.core.TermSet(value: T)

Bases: Node[Set[Term]]

A set of values

class hydra.core.TermTypeApplication(value: T)

Bases: Node[TypeApplicationTerm]

A System F type application term

class hydra.core.TermTypeLambda(value: T)

Bases: Node[TypeLambda]

A System F type abstraction term

class hydra.core.TermUnit

Bases: object

A unit value; a term with no value

class hydra.core.TermUnwrap(value: T)

Bases: Node[Name]

An unwrap elimination; the inverse of a wrap. Given the name of a wrapper type, unwraps an instance of that type to its underlying body value.

class hydra.core.TermVariable(value: T)

Bases: Node[Name]

A variable reference

class hydra.core.TermWrap(value: T)

Bases: Node[WrappedTerm]

A wrapped term; an instance of a wrapper type (newtype)

class hydra.core.Type

Bases: object

TypeAnnotated | TypeApplication | TypeEffect | TypeEither | TypeForall | TypeFunction | TypeList | TypeLiteral | TypeMap | TypeOptional | TypePair | TypeRecord | TypeSet | TypeUnion | TypeUnit | TypeVariable | TypeVoid | TypeWrap

ANNOTATED = Name(value='annotated')
APPLICATION = Name(value='application')
EFFECT = Name(value='effect')
EITHER = Name(value='either')
FORALL = Name(value='forall')
FUNCTION = Name(value='function')
LIST = Name(value='list')
LITERAL = Name(value='literal')
MAP = Name(value='map')
OPTIONAL = Name(value='optional')
PAIR = Name(value='pair')
RECORD = Name(value='record')
SET = Name(value='set')
TYPE_ = Name(value='hydra.core.Type')
UNION = Name(value='union')
UNIT = Name(value='unit')
VARIABLE = Name(value='variable')
VOID = Name(value='void')
WRAP = Name(value='wrap')
class hydra.core.TypeAnnotated(value: T)

Bases: Node[AnnotatedType]

An annotated type

class hydra.core.TypeApplication(value: T)

Bases: Node[ApplicationType]

A type application

class hydra.core.TypeApplicationTerm(body: Annotated[Term, 'The term being applied to a type'], type: Annotated[Type, 'The type argument'])

Bases: object

A term applied to a type; a type application.

BODY = Name(value='body')
class Builder(_body: 'Term' = None, _type: 'Type' = None)

Bases: object

body(body)
build()
type(type)
TYPE = Name(value='type')
TYPE_ = Name(value='hydra.core.TypeApplicationTerm')
body: Annotated[Term, 'The term being applied to a type']
static builder()
type: Annotated[Type, 'The type argument']
with_body(body)
with_type(type)
class hydra.core.TypeClassConstraint

Bases: object

TypeClassConstraintSimple

SIMPLE = Name(value='simple')
TYPE_ = Name(value='hydra.core.TypeClassConstraint')
class hydra.core.TypeClassConstraintSimple(value: T)

Bases: Node[Name]

A simple type class constraint, naming a single type class

class hydra.core.TypeEffect(value: T)

Bases: Node[Type]

An effectful computation which, when interpreted by a host application, may perform host interactions and produce a value of the given type

class hydra.core.TypeEither(value: T)

Bases: Node[EitherType]

An either (sum) type

class hydra.core.TypeForall(value: T)

Bases: Node[ForallType]

A universally quantified (polymorphic) type

class hydra.core.TypeFunction(value: T)

Bases: Node[FunctionType]

A function type

class hydra.core.TypeLambda(parameter: Annotated[Name, 'The type variable introduced by the abstraction'], body: Annotated[Term, 'The body of the abstraction'])

Bases: object

A System F type abstraction term.

BODY = Name(value='body')
class Builder(_parameter: 'Name' = None, _body: 'Term' = None)

Bases: object

body(body)
build()
parameter(parameter)
PARAMETER = Name(value='parameter')
TYPE_ = Name(value='hydra.core.TypeLambda')
body: Annotated[Term, 'The body of the abstraction']
static builder()
parameter: Annotated[Name, 'The type variable introduced by the abstraction']
with_body(body)
with_parameter(parameter)
class hydra.core.TypeList(value: T)

Bases: Node[Type]

A list type

class hydra.core.TypeLiteral(value: T)

Bases: Node[LiteralType]

A literal type

class hydra.core.TypeMap(value: T)

Bases: Node[MapType]

A map type

class hydra.core.TypeOptional(value: T)

Bases: Node[Type]

An optional type

class hydra.core.TypePair(value: T)

Bases: Node[PairType]

A pair (2-tuple) type

class hydra.core.TypeRecord(value: T)

Bases: Node[Sequence[FieldType]]

A record type

class hydra.core.TypeScheme(variables: Annotated[Sequence[Name], 'The free type variables'], body: Annotated[Type, 'The type expression'], constraints: Annotated[Mapping[Name, TypeVariableConstraints], 'Constraints on type variables, including typeclass constraints. The map keys are type variable names; an empty map means no constraints.'])

Bases: object

A type expression together with free type variables occurring in the expression.

BODY = Name(value='body')
class Builder(_variables: 'Sequence[Name]' = None, _body: 'Type' = None, _constraints: 'Mapping[Name, TypeVariableConstraints]' = None)

Bases: object

body(body)
build()
constraints(constraints)
variables(variables)
CONSTRAINTS = Name(value='constraints')
TYPE_ = Name(value='hydra.core.TypeScheme')
VARIABLES = Name(value='variables')
body: Annotated[Type, 'The type expression']
static builder()
constraints: Annotated[Mapping[Name, TypeVariableConstraints], 'Constraints on type variables, including typeclass constraints. The map keys are type variable names; an empty map means no constraints.']
variables: Annotated[Sequence[Name], 'The free type variables']
with_body(body)
with_constraints(constraints)
with_variables(variables)
class hydra.core.TypeSet(value: T)

Bases: Node[Type]

A set type

class hydra.core.TypeUnion(value: T)

Bases: Node[Sequence[FieldType]]

A union type with field names

class hydra.core.TypeUnit

Bases: object

The unit type — the nullary conjunction; one inhabitant. Dual to void.

class hydra.core.TypeVariable(value: T)

Bases: Node[Name]

A type variable

class hydra.core.TypeVariableConstraints(classes: Annotated[Set[TypeClassConstraint], 'The typeclass constraints on this type variable'])

Bases: object

Constraints associated with a type variable, including typeclass constraints.

class Builder(_classes: 'Set[TypeClassConstraint]' = None)

Bases: object

build()
classes(classes)
CLASSES = Name(value='classes')
TYPE_ = Name(value='hydra.core.TypeVariableConstraints')
static builder()
classes: Annotated[Set[TypeClassConstraint], 'The typeclass constraints on this type variable']
with_classes(classes)
class hydra.core.TypeVoid

Bases: object

The void (uninhabited, or bottom) type — the nullary disjunction; zero inhabitants. Dual to unit.

class hydra.core.TypeWrap(value: T)

Bases: Node[Type]

A wrapped type (newtype). There is no corresponding unwrap variant at the type level: wrap is the introduction form, and a wrapper type’s underlying body type is given by the wrap variant’s argument.

class hydra.core.WrappedTerm(type_name: Annotated[Name, 'The name of the wrapper type'], body: Annotated[Term, 'The wrapped term'])

Bases: object

A term wrapped in a type name.

BODY = Name(value='body')
class Builder(_type_name: 'Name' = None, _body: 'Term' = None)

Bases: object

body(body)
build()
type_name(type_name)
TYPE_ = Name(value='hydra.core.WrappedTerm')
TYPE_NAME = Name(value='typeName')
body: Annotated[Term, 'The wrapped term']
static builder()
type_name: Annotated[Name, 'The name of the wrapper type']
with_body(body)
with_type_name(type_name)