HindleyMilnerTypeSystem.md (760B)
1 # Hindley-Milner Type System 2 3 **Source:** [https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system](https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system) 4 5 **Definition:** Hindley-Milner type systems are type systems with parametric poymorphism based on the lambda calculus where types can be checked without the programmer supplying any information about variable typing. 6 7 ## Example 8 9 ```OCaml 10 let lt x y = x < y;; 11 12 val lt : a' -> a' -> bool = <fun> 13 14 let () = print_endline (string_of_bool (lt 10 100));; 15 16 true 17 18 let () = print_endline (string_of_bool (lt "andrew" " bob"));; 19 20 false 21 22 ``` 23 24 In this context, the `lt` function is a function with the type a' -> a' -> bool where a' informs us that the function is parametrically polymorphic.