hydra.decoding module

Functions for generating term decoders from type modules.

hydra.decoding.collect_forall_variables(typ: Type) Sequence[Name]

Collect forall type variable names from a type.

hydra.decoding.collect_ord_constrained_variables(typ: Type) Sequence[Name]

Collect type variables needing Ord constraints (from Map key and Set element types).

hydra.decoding.collect_type_variables(typ: Type) Sequence[Name]

Collect type variable names from a type (forall parameters only).

hydra.decoding.collect_type_variables_from_type(typ: Type) Sequence[Name]

Collect all type variable names from a type expression.

hydra.decoding.decode_binding(cx: T0, graph: Graph, b: Binding) object

Transform a type binding into a decoder binding.

hydra.decoding.decode_binding_name(v1: Name) Name

Generate a binding name for a decoder function from a type name.

hydra.decoding.decode_either_type(et: EitherType) Term

Generate a decoder for an Either type.

hydra.decoding.decode_forall_type(ft: ForallType) Term

Generate a decoder for a polymorphic (forall) type.

hydra.decoding.decode_list_type(elem_type: Type) Term

Generate a decoder for a list type.

hydra.decoding.decode_literal_type(lt: LiteralType) Term

Generate a decoder for a literal type.

hydra.decoding.decode_map_type(mt: MapType) Term

Generate a decoder for a map type.

hydra.decoding.decode_maybe_type(elem_type: Type) Term

Generate a decoder for an optional type.

hydra.decoding.decode_module(cx: T0, graph: Graph, mod: Module) object

Transform a type module into a decoder module.

hydra.decoding.decode_module_name(v1: ModuleName) ModuleName

Generate a decoder module name from a source module name.

hydra.decoding.decode_pair_type(pt: PairType) Term

Generate a decoder for a pair type.

hydra.decoding.decode_record_type(rt: Sequence[FieldType]) Term

Generate a decoder for a record type.

hydra.decoding.decode_record_type_impl(tname: Name, rt: Sequence[FieldType], rtype: Type) Term

Generate a decoder for a record type with a type name. rtype is the fully-applied result type (e.g. Table<v>) used for the record’s body annotations. (#476).

hydra.decoding.decode_record_type_named(ename: Name, rt: Sequence[FieldType], rtype: Type) Term

Generate a decoder for a record type with element name.

hydra.decoding.decode_set_type(elem_type: Type) Term

Generate a decoder for a set type.

hydra.decoding.decode_type(typ: Type) Term

Generate a decoder term for a Type.

hydra.decoding.decode_type_named(ename: Name, typ: Type, rtype: Type) Term

Generate a decoder term for a Type, with element name for nominal types. rtype is the FULLY-APPLIED result type for nominal bodies (e.g. DataRow<v> for forall v. wrap…), so the body’s intermediate type annotations carry the type parameters rather than a bare nominal name — otherwise Java/Scala coders emit raw types that fail to compile against the parameterized signature. (#476).

hydra.decoding.decode_union_type(rt: Sequence[FieldType]) Term

Generate a decoder for a union type.

hydra.decoding.decode_union_type_named(ename: Name, rt: Sequence[FieldType], rtype: Type) Term

Generate a decoder for a union type with the given element name. rtype is the fully-applied result type (e.g. Foo<v>) used for body annotations. (#476).

hydra.decoding.decode_wrapped_type(wt: Type) Term

Generate a decoder for a wrapped type.

hydra.decoding.decode_wrapped_type_named(ename: Name, wt: Type, rtype: Type) Term

Generate a decoder for a wrapped type with the given element name. rtype is the fully-applied result type (e.g. DataRow<v>) used for body annotations. (#476).

hydra.decoding.decoder_full_result_type(typ: Type) Type

Get full result type for decoder.

hydra.decoding.decoder_full_result_type_named(ename: Name, typ: Type) Type

Get full result type for decoder with element name.

hydra.decoding.decoder_result_type(typ: Type) Name

Compute the result type name for a decoder.

hydra.decoding.decoder_type(typ: Type) Type

Build decoder function type.

hydra.decoding.decoder_type_named(ename: Name, typ: Type) Type

Build decoder function type with element name.

hydra.decoding.decoder_type_scheme(typ: Type) TypeScheme

Build type scheme for a decoder function.

hydra.decoding.decoder_type_scheme_named(ename: Name, typ: Type) TypeScheme

Build type scheme for a decoder function with element name.

hydra.decoding.filter_type_bindings(cx: T0, graph: Graph, bindings: Sequence[Binding]) object

Filter bindings to only decodable type definitions.

hydra.decoding.is_decodable_binding(cx: T0, graph: Graph, b: Binding) object

Check if a binding is decodable (serializable type).

hydra.decoding.prepend_forall_decoders(base_type: Type, typ: Type) Type

Prepend decoder types for forall parameters to base type.