Petr P | 18 Jan 11:06 2013
Picon

resources for learning Hindley-Milner type inference for undergraduate students

  Dear Haskellers,

could somebody recommend me study materials for learning Hindley-Milner type inference algorithm I could recommend to undergraduate students? The original paper is harder to understand, I'm looking for something more didactic. The students are familiar with the lambda calculus, natural deduction and System F.

  Thanks for help, 
  Petr Pudlak
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Vo Minh Thu | 18 Jan 11:12 2013
Picon

Re: resources for learning Hindley-Milner type inference for undergraduate students

2013/1/18 Petr P <petr.mvd <at> gmail.com>:
>   Dear Haskellers,
>
> could somebody recommend me study materials for learning Hindley-Milner type
> inference algorithm I could recommend to undergraduate students? The
> original paper is harder to understand, I'm looking for something more
> didactic. The students are familiar with the lambda calculus, natural
> deduction and System F.

I think I really liked

    Cardelli's paper Basic Polymorphic Typechecking, 1987

HTH,
Thu
Anton Dergunov | 18 Jan 11:29 2013
Picon

Re: resources for learning Hindley-Milner type inference for undergraduate students

I also agree that Cardelli paper is great.

It was also very useful for me to follow Python implementation provided in the following blog post:
http://www.smallshire.org.uk/sufficientlysmall/2010/04/11/a-hindley-milner-type-inference-implementation-in-python/

I found it useful to investigate in Python debugger how various terms were interpreted.

You may also find useful implementations in Scala and Perl:
http://dysphoria.net/2009/06/28/hindley-milner-type-inference-in-scala/
http://web.archive.org/web/20050911123640/http://www.cs.berkeley.edu/~nikitab/courses/cs263/hm.html

Also, I have plans to read "Typing Haskell in Haskell" by Mark Jones and "Practical type inference for arbitrary-rank types" by Simon Peyton-Jones et. al. They are also related here, but not directly.

--
Best Regards,
Anton Dergunov

Пятница, 18 января 2013, 11:12 +01:00 от Vo Minh Thu <noteed <at> gmail.com>:
2013/1/18 Petr P <petr.mvd <at> gmail.com>:
> Dear Haskellers,
>
> could somebody recommend me study materials for learning Hindley-Milner type
> inference algorithm I could recommend to undergraduate students? The
> original paper is harder to understand, I'm looking for something more
> didactic. The students are familiar with the lambda calculus, natural
> deduction and System F.

I think I really liked

    Cardelli's paper Basic Polymorphic Typechecking, 1987

HTH,
Thu

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Jan Stolarek | 18 Jan 13:19 2013
Picon

Re: resources for learning Hindley-Milner type inference for undergraduate students

Dnia piątek, 18 stycznia 2013, Petr P napisał:
> for learning Hindley-Milner type inference algorithm I could recommend to
> undergraduate students? The original paper is harder to understand, I'm
> looking for something more didactic. The students are familiar with the
> lambda calculus, natural deduction and System F.

Perhaps chapters on H-M from Appel's "Modern compiler implementation in C/Java" would be good?

Janek

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Rustom Mody | 18 Jan 13:44 2013
Picon

Re: resources for learning Hindley-Milner type inference for undergraduate students

On Fri, Jan 18, 2013 at 5:49 PM, Jan Stolarek <jan.stolarek <at> p.lodz.pl> wrote:

Dnia piątek, 18 stycznia 2013, Petr P napisał:
> for learning Hindley-Milner type inference algorithm I could recommend to
> undergraduate students? The original paper is harder to understand, I'm
> looking for something more didactic. The students are familiar with the
> lambda calculus, natural deduction and System F.

What is the current opinion of Mark Jones Typing haskell in haskell?
http://web.cecs.pdx.edu/~mpj/thih/TypingHaskellInHaskell.html

[Note This is to add to the question more than the answer]
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe <at> haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Stephen Tetley | 18 Jan 18:25 2013
Picon

Re: resources for learning Hindley-Milner type inference for undergraduate students

There is a summary paper by Sunil Kothari and James L. Cladwell
covering the algorithms M, J and W with informal presentations plus
code available in Ocaml. Paper is on Citeseer, code is available from
Sunil Kothari's home page.

Martin Grabmueller has a tutorial implementation of algorithm W in Haskell:

http://www.grabmueller.de/martin/www/pub/pub.en.html

On 18 January 2013 10:06, Petr P <petr.mvd <at> gmail.com> wrote:
>   Dear Haskellers,
>
> could somebody recommend me study materials for learning Hindley-Milner type
> inference algorithm I could recommend to undergraduate students?
oleg | 19 Jan 06:57 2013

resources for learning Hindley-Milner type inference for undergraduate students


Petr Pudlak wrote:
> could somebody recommend me study materials for learning Hindley-Milner
> type inference algorithm I could recommend to undergraduate students? 

Perhaps you might like a two-lecture course for undergraduates, which
uses Haskell throughout

        http://okmij.org/ftp/Haskell/AlgorithmsH.html#teval

It explained HM type inference in a slightly different way, strongly
emphasizing type inference as a non-standard interpretation. The
second main idea was relating polymorphism and `inlining' (copying).
Type schemas were then introduced as an optimization, to inlining. It
becomes clear why it is unsound to infer a polymorphic type for ref
[]: expressions of polymorphic types are always inlined (conceptually,
at least), which goes against the dynamic semantics of reference
cells.

The lectures also show how to infer not only the type but also the
type environment. This inference helps to make the point that `tests'
cannot replace typing. We can type check open expressions (and infer
the minimal environment they make sense to use in). We cannot run
(that is, dynamically check) open expressions.

Gmane