In OCaml, if your project has a file called code.ml you can refer to it in other files using the module name Code. I was wondering if you defined an .mli file if you could refer to the signature it defines in a similar way. For example if you had a file called wow.mli and you could have another file with the declaration
module Func(St : Wow) = struct ... end
Is there a way to do something along those lines?
This works for me:
module Func(St: module type of Wow) = struct ... end
In detail here's what I did:
$ cat wow.mli
val f : int -> int
$ cat m.ml
module Func (St: module type of Wow) = struct let f x = St.f x end
$ ocamlopt -c wow.mli
$ ocamlopt -c m.ml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With