I'm fairly new with OCaml Module and I haven't managed to use my own module without combining both an "include" and an "open". I've tried to put the signature in a separate .mli file, without success.
Below I'm indicated a minimum (not) working example, that I'm trying to compile with
ocamlc -o main Robot.ml main.ml
What to I need to do to only have to use "open", or only "include", but not both of them ?
File "Robot.ml" :
module type RobotSignature =
sig
val top: unit -> unit
end
module Robot =
struct
let top () =
begin
Printf.printf "top\n"
end
(* Should not be visible from the 'main' *)
let dummy () =
begin
Printf.printf "dummy\n"
end
end
File "main.ml" (not working) :
open Robot;;
top();
File "main.ml" (working) :
include Robot;;
open Robot;;
top();