What is the difference between ‘a and ‘_l?

_ denotes a weakly polymorphic variable : it is in a position where it cannot be generalized. There are two explanations related to weak polymorphism in the OCaml FAQ: see A function obtained through partial application is not polymorphic enough and the next one. This generally happens when you’re using a non-local reference (whose type … Read more

The value restriction

Without the value restriction or other mechanisms to restrict generalization, this program would be accepted by the type system: let r = (fun x -> ref x) [];; (* this is the line where the value restriction would trigger *) > r : ‘a list ref r := [ 1 ];; let cond = (!r … Read more