News for hackers. Stuff that matters.
Re:What is Hindley-Milner and why is it cool? (2008) by chewxy on Sunday August 20, 2017 @11:38PM (#15061751)
It means check both ways

    Gamma |- e => t
Given Gamma (the environment) and e, you want to derive the type t (bog standard type inference).

The other direction also holds:

    Gamma |- e <= t
Now we want to ensure that e conforms to type t.

Consider for example, a function:

    func foo(a) b
and an expression that we know the type of already:

    e <= a
Therefore we can say when we apply `foo` onto `e`, we'll yield something of type `b`

In effect, you perform 2 passes: forwards inference, and then backwards inference.

p/s: I'm not actually a PL person. This is from my casual reading, so my understanding is highly probably very wrong

There are no comments on this comment yet.