Can someone give a concise description of when the relaxed value restriction kicks in? I've had trouble finding a concise and clear description of the rules. There's Garrigue's paper:

http://caml.inria.fr/pub/papers/garrigue-value_restriction-fiwflp04.pdf

but it's a little dense. Anyone know of a pithier source?

An Addendum

Some good explanations were added below, but I was unable to find an explanation there for the following behavior:

# let _x = 3 in (fun () -> ref None);;
- : unit -> 'a option ref = <fun>
# let _x = ref 3 in (fun () -> ref None);;
- : unit -> '_a option ref = <fun>

Can anyone clarify the above? Why does the stray definition of a ref within the RHS of the enclosing let affect the heuristic.

Edit
Report