hydra.analysis module
Module dependency module name analysis.
- hydra.analysis.add_names_to_module_names(encode_module_name: Callable[[ModuleName], T0], names: Set[Name], ns0: ModuleNames[T0]) ModuleNames[T0]
Add names to existing module names mapping.
- hydra.analysis.analyze_function_term(cx: InferenceContext, get_t_c: Callable[[T0], Graph], set_t_c: Callable[[Graph, T0], T0], env: T0, term: Term) object
Analyze a function term, collecting lambdas, type lambdas, lets, and type applications.
- hydra.analysis.analyze_function_term_with(cx: InferenceContext, for_binding: Callable[[Graph, Binding], object], get_t_c: Callable[[T0], Graph], set_t_c: Callable[[Graph, T0], T0], env: T0, term: Term) object
Analyze a function term with configurable binding metadata.
- hydra.analysis.analyze_function_term_with_finish(cx: InferenceContext, get_t_c: Callable[[T0], Graph], f_env: T0, tparams: Sequence[Name], args: Sequence[Name], bindings: Sequence[Binding], doms: Sequence[Type], tapps: Sequence[Type], body: Term) object
Final step of the function-term walk: type-apply the body and assemble the FunctionStructure.
- hydra.analysis.analyze_function_term_with_gather(cx: InferenceContext, for_binding: Callable[[Graph, Binding], object], get_t_c: Callable[[T0], Graph], set_t_c: Callable[[Graph, T0], T0], arg_mode: bool, g_env: T0, tparams: Sequence[Name], args: Sequence[Name], bindings: Sequence[Binding], doms: Sequence[Type], tapps: Sequence[Type], t: Term) object
Recursive step of the function-term walk: peel lambdas / type-lambdas / type-applications, accumulating params and bindings, then call analyzeFunctionTermWithFinish.
- hydra.analysis.definition_dependency_module_names(defs: Sequence[Definition]) Set[ModuleName]
Get dependency module names from definitions.
- hydra.analysis.dependency_module_names(cx: T0, graph: Graph, binds: bool, with_prims: bool, with_noms: bool, with_schema: bool, els: Sequence[Binding]) object
Find dependency module names in all of a set of terms (Either version).
- hydra.analysis.gather_applications(term: Term) tuple[Sequence[Term], Term]
Gather applications from a term, returning (args, baseTerm).
- hydra.analysis.gather_args(term: Term, args: Sequence[Term]) tuple[Term, Sequence[Term]]
Gather term arguments, stripping type-level constructs.
- hydra.analysis.gather_args_with_type_apps(term: Term, args: Sequence[Term], ty_args: Sequence[Type]) tuple[Term, tuple[Sequence[Term], Sequence[Type]]]
Gather term and type arguments from a term.
- hydra.analysis.is_self_tail_recursive(func_name: Name, body: Term) bool
Check if a term body is self-tail-recursive with respect to a function name.
- hydra.analysis.is_simple_assignment(term: Term) bool
Check if a term can be encoded as a simple assignment.
- hydra.analysis.is_tail_recursive_in_tail_position(func_name: Name, term: Term) bool
Check that all self-references are in tail position.
- hydra.analysis.module_contains_binary_literals(mod: Module) bool
Check whether a module contains any binary literal values.
- hydra.analysis.module_contains_decimal_literals(mod: Module) bool
Check whether a module contains any decimal literal values.
- hydra.analysis.module_dependency_module_names(cx: T0, graph: Graph, binds: bool, with_prims: bool, with_noms: bool, with_schema: bool, mod: Module) object
Find dependency module names in all elements of a module, excluding the module’s own module name (Either version).
- hydra.analysis.module_names_for_definitions(encode_module_name: Callable[[ModuleName], T0], focus_ns: ModuleName, defs: Sequence[Definition]) ModuleNames[T0]
Create module names mapping for definitions.