OCaml REPL displays the value and type of any expression. For example, evaluating:
let rec map f = function | [] -> [] | x::l -> fx :: map fl;;
gives:
val map : ('a -> 'b) -> 'a list -> 'b list = <fun>
This is not practical for language learning.
I'm considering switching to Reason, but how would you get the same information?
let rec map = (f) => fun | [] => [] | [x, ...l] => [f(x), ...map(f, l)];
Try Reason does not display any type, and I'm not sure if REPL exists for Reason.
source share