Algorithm W

E807600

Algorithm W is a classic type inference algorithm that efficiently computes principal types in the Hindley–Milner type system used by many functional programming languages.

All labels observed (1)

Label Occurrences
Algorithm W canonical 3

How this entity was disambiguated

Statements (46)

Predicate Object
instanceOf algorithm
type inference algorithm
alternativeTo Algorithm J
constraint-based type inference algorithms
assumes no user-written type annotations are required for basic inference
rank-1 polymorphism (Hindley–Milner polymorphism)
basedOn Hindley–Milner type system
complexity typically near-linear in size of term for practical programs
computes principal types
coreStep generalizes types at let-bindings
generates type equations
recursively infers types for subexpressions
solves type equations via unification
describedIn "Principal type-schemes for functional programs"
domain programming language theory
static type checking
goal infer most general type without annotations
influenced design of many statically typed functional languages
type inference in Haskell
type inference in ML
input untyped lambda calculus term with let-bindings (Hindley–Milner syntax)
introducedBy Luis Damas
Robin Milner
introducedInContextOf type assignment for the Hindley–Milner system
notDesignedFor GADTs
higher-rank polymorphism
type classes (as in full Haskell)
output most general type (principal type) of the term
property complete with respect to Hindley–Milner type system
sound with respect to Hindley–Milner type system
terminating on well-formed inputs
publicationYear 1982 (original Damas–Milner paper)
representation produces type schemes with universally quantified variables
uses type variables for unknown types
supportsFeature let-polymorphism
polymorphic type inference
principal type computation
unification-based constraint solving
usedIn Haskell (core Hindley–Milner fragment)
linked to: Haskell

ML family of languages
linked to: Alice ML

OCaml (core Hindley–Milner fragment)
linked to: OCaml

Standard ML
functional programming languages
usesTechnique environment-based type assignment
substitution
unification

How these facts were elicited

Referenced by (3)

Full triples — surface form annotated when it differs from this entity's canonical label.

HM type system inferenceAlgorithm Algorithm W
Algorithm J relatedTo Algorithm W