ML Programming Assignment: type synthesis for Core-ML

Due Monday, November 27


Your assignment is to implement in ML (SML or Caml) a type synthetizer for Core-ML using non-destructive unification, as shown in slides 22-25 of the lecture about Core-ML type inference. Your type synthetizer may follow closely the algorithm presented there.

You should use my implementation of substitution and unification (here in SML or here in Caml), and implement the function

infer: expr -> environment -> (mltype * substitution)


using as many auxiliary functions as necessary.

It's no problem if you extend the datatype expr and/or the datatype mltype, and your inference function to handle a larger language (primitive operations, data structures, ...). If treated correctly, that may give you extra credit. If incorrect, I'll simply ignore the extensions.

Also, you should give a set of relevant examples showing clearly the results of your implementation in different situations (failures, polymorphism, ...).

If you have any question, please post it in the class mailing list.