Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've found the following: http://okmij.org/ftp/Haskell/AlgorithmsH.html#teval

to be very useful for understanding how the HM type algorithm works.

They rephrase the problem as "writing an expression interpreter" for your program that recursively evaluates the abstract types of each expression instead of the concrete value.

I found this to be a very intuitive way to understand it.

It also then makes it easier to see why some "type inference" algorithms might guarantee to terminate while others might run forever: the more complicated your type system, the less abstract the "type values" are. They become like actual "values", and the behaviour becomes closer to the actual running of the program, which may not terminate.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: