Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I found the following resources helpful for understanding type inference, in order of increasing difficulty:</p> <ol> <li>Chapter 30 (Type Inference) of <a href="http://www.plai.org" rel="noreferrer">the freely available book PLAI</a>, <em>Programming Languages: Application and Interpretation</em>, sketches unification-based type inference.</li> <li>The summer course <a href="http://okmij.org/ftp/Computation/Computation.html#teval" rel="noreferrer"><em>Interpreting types as abstract values</em></a> presents elegant evaluators, type checkers, type reconstructors and inferencers using Haskell as a metalanguage.</li> <li>Chapter 7 (Types) of <a href="http://www.eopl3.com/" rel="noreferrer">the book EOPL</a>, <em>Essentials of Programming Languages</em>. </li> <li>Chapter 22 (Type Reconstruction) of <a href="http://www.cis.upenn.edu/~bcpierce/tapl/" rel="noreferrer">the book TAPL</a>, <em>Types and Programming Languages</em>, and the corresponding OCaml implementations <a href="http://www.cis.upenn.edu/~bcpierce/tapl/checkers/recon/core.ml" rel="noreferrer">recon</a> and <a href="http://www.cis.upenn.edu/~bcpierce/tapl/checkers/fullrecon/core.ml" rel="noreferrer">fullrecon</a>.</li> <li>Chapter 13 (Type Reconstruction) of <a href="http://dcpl.mit.edu/" rel="noreferrer">the new book DCPL</a>, <em>Design Concepts in Programming Languages</em>.</li> <li><a href="https://pinboard.in/u:namin/t:type-inference+paper" rel="noreferrer">Selection of academic papers</a>.</li> <li>Closure compiler's <a href="http://www.google.com/codesearch/p?hl=en#l5BkQmivP-Y/trunk/src/com/google/javascript/jscomp/TypeInference.java&amp;q=TypeInference%20package:http://closure-compiler%5C.googlecode%5C.com&amp;sa=N&amp;cd=1&amp;ct=rc" rel="noreferrer">TypeInference</a> is an example of the data-flow analysis approach to type inference, which is better suited to dynamic languages that the Hindler Milner approach.</li> </ol> <p>However, since the best way to learn is to do, I strongly suggest implementing type inference for a toy functional language by working through a homework assignment of a programming languages course.</p> <p>I recommend these two accessible homeworks in ML, which you can both complete in less than a day: </p> <ol> <li><a href="http://users.cs.fiu.edu/~smithg/cop4555/hw5.html" rel="noreferrer">PCF Interpreter</a> (<a href="http://github.com/namin/spots/tree/master/pcf/interp1.sml" rel="noreferrer">a solution</a>) to warm up.</li> <li><a href="http://users.cs.fiu.edu/~smithg/cop4555/hw6.html" rel="noreferrer">PCF Type Inference</a> (<a href="http://github.com/namin/spots/tree/master/pcf/type.sml" rel="noreferrer">a solution</a>) to implement algorithm W for Hindley-Milner type inference.</li> </ol> <p><a href="http://www.cs.cmu.edu/~fp/courses/15312-f04/assignments.html" rel="noreferrer">These assignments</a> are from a more advanced course:</p> <ol> <li><p><a href="http://www.cs.cmu.edu/~fp/courses/15312-f04/assignments/asst2/index.html" rel="noreferrer">Implementing MiniML</a></p></li> <li><p><a href="http://www.cs.cmu.edu/~fp/courses/15312-f04/assignments/asst5.pdf" rel="noreferrer">Polymorphic, Existential, Recursive Types (PDF)</a></p></li> <li><p><a href="http://www.cs.cmu.edu/~fp/courses/15312-f04/assignments/asst6/index.html" rel="noreferrer">Bi-Directional Typechecking (PDF)</a></p></li> <li><p><a href="http://www.cs.cmu.edu/~fp/courses/15312-f04/assignments/asst7.pdf" rel="noreferrer">Subtyping and Objects (PDF)</a></p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload