hydra.predicates module

Type and term classification predicates.

hydra.predicates.is_complex_binding(tc: Graph, b: Binding) bool

Check if a binding needs to be treated as a function.

hydra.predicates.is_complex_term(tc: Graph, t: Term) bool

Check if a term needs to be treated as a function rather than a simple value.

hydra.predicates.is_complex_variable(tc: Graph, name: Name) bool

Check if a variable is bound to a complex term.

hydra.predicates.is_encoded_term(t: Term) bool

Determines whether a given term is an encoded term (meta-level term).

hydra.predicates.is_encoded_type(t: Term) bool

Determines whether a given term is an encoded type.

hydra.predicates.is_enum_row_type(rt: Sequence[FieldType]) bool

Check if a row type represents an enum (all fields are unit-typed).

hydra.predicates.is_enum_type(typ: Type) bool

Check if a type is an enum type.

hydra.predicates.is_nominal_type(typ: Type) bool

Check whether a type is a nominal type definition (record, union, wrap, or forall wrapping one). Type aliases (applications, functions, literal types, etc.) return false.

hydra.predicates.is_serializable(cx: T0, graph: Graph, el: Binding) object

Check if an element is serializable (no function, effect, or void types in dependencies) (Either version).

hydra.predicates.is_serializable_by_name(cx: T0, graph: Graph, name: Name) object

Check if a type (by name) is serializable, resolving all type dependencies (no function, effect, or void types) (Either version).

hydra.predicates.is_serializable_type(typ: Type) bool

Check if a type is serializable (no function, effect, or void types in the type itself).

hydra.predicates.is_trivial_term(t: Term) bool

Check if a term is trivially cheap (no thunking needed).

hydra.predicates.is_type(t: Type) bool

Check whether a type is a type (always true for non-encoded types).

hydra.predicates.is_unit_term(v1: Term) bool

Check whether a term is the unit term.

hydra.predicates.is_unit_type(v1: Type) bool

Check whether a type is the unit type.

hydra.predicates.type_dependencies(cx: T0, graph: Graph, with_schema: bool, transform: Callable[[Type], Type], name: Name) object

Get all type dependencies for a given type name (Either version).