Show HN: Hindley-Milner Type Inference Algorithm in OCaml
1–10 of 30 posts
Re: Show HN: Hindley-Milner Type Inference Algorithm in OCaml
#2It's a little unfortunate that this version doesn't include let-polymorphism, since that's necessary for parametrically polymorphic functions to be actually polymorphic, and it's not a recent addition — it's in the original Damas-Milner paper. All the other stuff about tuples, lists, sum types, and whatnot can be emulated with functions, but not let-polymorphism, not without a potentially exponential blowup in the program size.
Re: Show HN: Hindley-Milner Type Inference Algorithm in OCaml
#3This is cool! It's nice to have a bite-sized runnable illustration of HM. Maybe I will finally be able to understand it — both the code and the linked lecture notes ( http://www.cs.cornell.edu/courses/cs3110/2011sp/lectures/lec... ) look pretty informative. I don't think I can digest it in time to comment before it scrolls off the HN front page. It's a little unfortunate that this version doesn't include let-polymorp…
I'm assuming a lot developers like me would be keen to understand how HM works, so I was considering writing a detailed tutorial of the unification algorithm step-by-step. Would you be interested in something along those lines?
[0] - http://www.cs.columbia.edu/~sedwards/classes/2016/4115-sprin...
[1] - http://dev.stephendiehl.com/fun/006_hindley_milner.html
Re: Show HN: Hindley-Milner Type Inference Algorithm in OCaml
#4http://smallshire.org.uk/sufficientlysmall/2010/04/11/a-hind...
Re: Show HN: Hindley-Milner Type Inference Algorithm in OCaml
#5This is cool! It's nice to have a bite-sized runnable illustration of HM. Maybe I will finally be able to understand it — both the code and the linked lecture notes ( http://www.cs.cornell.edu/courses/cs3110/2011sp/lectures/lec... ) look pretty informative. I don't think I can digest it in time to comment before it scrolls off the HN front page. It's a little unfortunate that this version doesn't include let-polymorp…
Thanks for the feedback! This is actually a smaller part of a much bigger full-blown type-inferred programming language[0], we've been working on as a part of course in school. Our plan was to directly add type-inference in the language but after reading through Stephen Diehl's tutorial[1] we were intimidated and wanted to have a working version on a bite-sized language. I'm assuming a lot developers like me would be…
Re: Show HN: Hindley-Milner Type Inference Algorithm in OCaml
#6Re: Show HN: Hindley-Milner Type Inference Algorithm in OCaml
#7Re: Show HN: Hindley-Milner Type Inference Algorithm in OCaml
#8Re: Show HN: Hindley-Milner Type Inference Algorithm in OCaml
#9Earlier quoted context omitted.
Thanks for the feedback! This is actually a smaller part of a much bigger full-blown type-inferred programming language[0], we've been working on as a part of course in school. Our plan was to directly add type-inference in the language but after reading through Stephen Diehl's tutorial[1] we were intimidated and wanted to have a working version on a bite-sized language. I'm assuming a lot developers like me would be…
No link to Columbia's PLT lectures? :)
Re: Show HN: Hindley-Milner Type Inference Algorithm in OCaml
#10Oleg has a nice article on how to implement OCaml-style type inference. It's a more sophisticated approach than just Algorithm W: http://okmij.org/ftp/ML/generalization.html