3 ms·
Hindley Milner is awesome and surpursingly not super hard to implement. Shameless plug: Wrote a minimal implementation in OCaml back in college https://github.c
by krat0sprakhar 9y ago
Hindley Milner is awesome and surpursingly not super hard to implement. Shameless plug: Wrote a minimal implementation in OCaml back in college https://github.com/prakhar1989/type-inference https://github.com/prakhar1989/type-inference
- chewxy 9y agoThe challenge is of course writing one that is fast enough to be used for runtime-compilation (imagine a service that compiles code). I had to rewrite mine (https://github.com/chewxy/hm https://github.com/chewxy/hm) twice, and finally removing typeclasses to be fast enough for a inference system I wrote.
- mbrock 9y agoI first became interested in programming language theory back in high school when a guy in an IRC chat, who was a student at UIUC, asked me to do his homework for him. The assignment was to implement Hindley-Milner type checking with unification in OCaml. Thanks, lazy IRC guy!
- jjtheblunt 9y agoWow, good for you, ridiculous for the student's integrity; from UIUC also.
- Profan 9y agoHindley Milner is quite elegant, but as applied in languages it becomes a quite different beast (OCaml etc, yikes) But also thanks to that detour, this article is a nice read on OCaml in particular: http://okmij.org/ftp/ML/generalization.html http://okmij.org/ftp/ML/generalization.html