hydra.dsls module
Functions for generating domain-specific DSL modules from type modules.
- hydra.dsls.collect_forall_vars(typ: Type) Sequence[Name]
Collect forall type variable names from a type.
- hydra.dsls.deduplicate_bindings(bindings: Sequence[Binding]) Sequence[Binding]
Deduplicate bindings by appending numeric suffixes to duplicate names.
- hydra.dsls.dsl_binding_name(v1: Name) Name
Generate a binding name for a DSL function from a type name.
- hydra.dsls.dsl_definition_name(v1: Name, v2: str) Name
Generate a qualified DSL element name from a type name and local element name.
- hydra.dsls.dsl_module(cx: T0, graph: Graph, mod: Module) object
Transform a source module into a DSL module.
- hydra.dsls.dsl_module_name(v1: ModuleName) ModuleName
Generate a DSL module name from a source module name.
- hydra.dsls.dsl_signature_type_scheme(sig: TermSignature) TypeScheme
Build a TypedTerm-wrapped TypeScheme (functions of phantom terms) from a TermSignature.
- hydra.dsls.dsl_type_scheme(orig_type: Type, param_types: Sequence[Type], result_type: Type) TypeScheme
Build a TypeScheme with TypedTerm-wrapped parameter and result types.
- hydra.dsls.filter_type_bindings(cx: T0, graph: T1, bindings: Sequence[Binding]) object
Filter bindings to only DSL-eligible type definitions.
- hydra.dsls.generate_bindings_for_type(cx: T0, graph: Graph, b: Binding) object
Generate all DSL bindings for a type binding.
- hydra.dsls.generate_parametric_ref_builders(orig_type: Type, type_name: Name) Sequence[Binding]
Generate encode/decode composition builders for a parametric type definition.
- hydra.dsls.generate_record_accessor(orig_type: Type, type_name: Name, ft: FieldType) Binding
Generate a record field accessor function.
- hydra.dsls.generate_record_constructor(orig_type: Type, type_name: Name, field_types: Sequence[FieldType]) Sequence[Binding]
Generate a record constructor function.
- hydra.dsls.generate_record_with_updater(orig_type: Type, type_name: Name, all_fields: Sequence[FieldType], target_field: FieldType) Binding
Generate a withXxx record field updater function.
- hydra.dsls.generate_ref_bindings(d: Definition) object
Generate typed reference DSL bindings for a primitive (or signature-carrying term) definition.
- hydra.dsls.generate_signature_ref(ref_name: Name, sig: TermSignature) Binding
Generate a typed-reference DSL wrapper from a term/primitive name and signature.
- hydra.dsls.generate_type_name_token(orig_type: Type, type_name: Name) Binding
Generate a TypedName token constant for a type definition.
- hydra.dsls.generate_union_injector(orig_type: Type, type_name: Name, ft: FieldType) Binding
Generate a union injection helper.
- hydra.dsls.generate_wrapped_type_accessors(orig_type: Type, type_name: Name, inner_type: Type) Sequence[Binding]
Generate wrap/unwrap accessors for a wrapped type.
- hydra.dsls.is_dsl_eligible_binding(cx: T0, graph: T1, b: Binding) object
Check if a binding is eligible for DSL generation.
- hydra.dsls.nominal_result_type(type_name: Name, orig_type: Type) Type
Build the nominal result type with type applications for forall variables.
- hydra.dsls.signature_is_void_free(sig: TermSignature) bool
Check whether a term signature’s parameter and result types are all void-free.