Tiago Cogumbreiro

O Irrepupável

Back to top

Wednesday, February 04, 2009

Hindley/Milner Type Inference Algorithm implementated in Haskell (untested and naïve)

I do not program in Haskell in a couple of years. Today I needed to learn the Hendley/Milner algorithm for type inference and decided to implement it in Haskell. A far more interesting related blog post is one about “Writing A Lisp Interpreter In Haskell”, by Slava Akhmechet.

You can grab the (hardly tested) code, released under public domain, in Pastebin at http://pastebin.com/f7dede189. The Source Code Is The Documentation™.

I can't stress enough the usefulness of algebraic data types and declarative languages for creating compilers. But alas, I am still working with Java in my research projects.

Update: Because I have somehow broken the indentation, I have taken the chance to re-upload the source code, while cleaning up some code. Added a nice link about interpreter implementation using Haskell.

6 comments:

Anonymous said...

It sounds like you're creating problems yourself by trying to solve this issue instead of looking at why their is a problem in the first place.

Tiago Cogumbreiro said...

@Anon1: could you be more clear, please?

@Anon2: To subscribe please use the link http://feeds.feedburner.com/irrepupavel

Anonymous said...

Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!

Anonymous said...

Amiable post and this mail helped me alot in my college assignement. Thanks you on your information.

Anonymous said...

Opulently I to but I think the collection should have more info then it has.

Anonymous said...

Genial fill someone in on and this mail helped me alot in my college assignement. Thank you for your information.