[Real world Ocaml] How do I import core_unix time?

You should look more closely core_unix v0.15.0 · OCaml Package

There is a gray lib tag in front of core_unix.time_unix. This means you should include this lib (Typically (libraries core_unix core_unix.time_unix) with dune.

I guess the OCaml ecosystem a bit more complex than Rust. A package (core_unix) can provides multiple libraries (here core_unix.time_unix and others), and each library may provide multiple modules (lwt is such a library).

Note, the RWO notes you link indicates…

If you import Core or Base into the REPL’s namespace, you’ll get this signature:

val destutter : int list -> int list = <fun>

Which is plainly incorrect

The note miss the point. The Base/Core library change the equal sign and make the (=) funtion only deals with integer. Then with this module opened, we have to be more explicit (let open String in s1 = s2 or String.equal s1 s1).

The original OCaml approach is easier to use… the Base/Core approach renders the code more explicit. The original OCaml (=)is still available in the Caml module.

2 Likes