gleamunison/infer_unify

Structural unification with fresh inference variables. Expected type variables are shifted above every source-local variable before matching; a binding therefore cannot accidentally capture a lambda’s local type.

Types

pub type Bindings =
  List(#(Int, ast.Type))

Values

pub fn substitute_all(
  typ: ast.Type,
  bindings: List(#(Int, ast.Type)),
) -> ast.Type
pub fn unify(
  expected: ast.Type,
  actual: ast.Type,
) -> Result(List(#(Int, ast.Type)), Nil)
✨ Search Document