Type.Function.Var (mavis v0.0.6) View Source

a special container type indicating that the function has a type dependency.


The following typespec:

@spec identity(x) :: x when x: var

generates the following typespec:

  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:

  params: [%Type.Function.Var{name: :x, constraint: %Type{name: :integer}}],
  return: %Type.Function.Var{name: :x, constraint: %Type{name: :integer}}

Link to this section Summary

Link to this section Types


t() :: %Type.Function.Var{constraint: Type.t(), name: atom()}