I am learning / playing with ocaml in utop. Following the real world ocaml book.
So naturally I started with:
open Base;;
Next I try:
utop # String.sub "Hello world!" 3 4;;
Line 1, characters 0-10:
Warning 6 [labels-omitted]: labels pos, len were omitted in the application of this function.
Line 1, characters 0-10:
Warning 6 [labels-omitted]: labels pos, len were omitted in the application of this function.
- : string = "lo w"
Okay, more or less as expected. Base replaces many standard functions like String.sub with versions that use labeled arguments for clarity (arguably a good thing, so I have no complaint about that really).
But here's what's confusing to me. When I try to check the signature / type of the improved String.sub, I expected to see an improved function signature similar to the 'standard' String.sub signature (string -> int -> int -> string) but with labeled arguments. What I see instead is this:
utop # String.sub;;
- : (string, string) Blit.sub = <fun>
What is the meaning of that? And how can a (naive) user use this to determine the proper way to call the String.sub function?
I.e. how do I find out from a signature like (string, string) Blit.sub...
- that it is a function?
- what types of arguments it expects?
- what labels it expects on the arguments?
- what type of value it returns?