Type.Function.Var (mavis v0.0.6) View Source
a special container type indicating that the function has a type dependency.
Example:
The following typespec:
@spec identity(x) :: x when x: var
generates the following typespec:
%Type.Function{
params: [%Type.Function.Var{name: :x}],
return: %Type.Function.Var{name: :x}
}
if you further put a restriction on this typespec:
@spec identity(x) :: x when x: integer
the Type.Function.Var
will further exhibit the issued constraint:
%Type.Function{
params: [%Type.Function.Var{name: :x, constraint: %Type{name: :integer}}],
return: %Type.Function.Var{name: :x, constraint: %Type{name: :integer}}
}