I don't understand that the function (my_path_mapper) doesn't subject to the value restriction.
# let rec my_map ~f l =
match l with
[] -> []
| h::t -> f h::my_map f t;;
val my_map : f:('a -> 'b) -> 'a list -> 'b list = <fun>
# let my_path_mapper =
my_map ["/usr/sbin"; "/usr/bin"; "/sbin"; "/bin"; "/usr/games"; "/usr/local/games"];;
val my_path_mapper : f:(string -> 'a) -> 'a list = <fun>
Please teach me Why ?
OCaml has a "relaxed value restriction." You can read about it here:
Jacques Garrigue, Relaxing the Value Restriction
Here is a previous discussion on StackOverflow: