View Source cure_dependent_parser (cure v0.7.0)
Dependent Type Parser Support
This module provides parser helper functions for dependent type syntax introduced in Phase 6. It extends the main parser with support for:
- Type-level parameters (both type and value parameters)
- Type-level expressions (arithmetic, comparisons)
- Dependent function types
- Value parameter constraints
Examples
Parsing Type-Level Parameters
type Vector(T, n: Nat) = List(T) when length(this) == n
% ^ ^^^^^^^^^ value parameter
% | type parameterParsing Dependent Function Types
def concat<T, m: Nat, n: Nat>(
v1: Vector(T, m),
v2: Vector(T, n)
): Vector(T, m + n) = ...
% ^^^^^^^ type-level expressionUsage
These functions are called by the main parser (cure_parser.erl) when
encountering dependent type syntax.
Summary
Types
Functions
-spec make_dependent_function_type([#type_param{name :: term(), kind :: term(), type :: term(), constraint :: term(), location :: term()}], [#param{name :: term(), type :: term(), location :: term()}], term(), [term()], location()) -> #dependent_function_type{type_params :: term(), params :: term(), return_type :: term(), constraints :: term(), location :: term()}.