Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Language.HM.AlgorithmW
Typing contexts
External interface
runW :: Context -> Term -> Either TypeError TyTerm Source
runW
gamma term
runs Algorithm W on term
with an initial context
gamma
and returns an updated term
with explicit type annotations.
inferW :: Context -> Term -> Either TypeError Tau Source
inferW
gamma term
runs Algorithm W on term
with an initial context
gamma
and returns the polymorphic type of the whole term.
Misc
genInOrder :: Context -> Tau -> Sigma Source
genInOrder
ctx t
generalises a monomorphic type t
to a polymorphic
type in a context ctx
. This variant of gen
ensures that the order of
quantifiers matches that in which type variables occur in t
.