简体   繁体   中英

OCaml: single-file modules signature definition without using a .mli file?

Using a bunch of generated OCaml files for which it would be simpler to define a top module's signature without using a .mli file the same way it is done for nested modules. For example in Mymodule.ml be able to write something like:

module self/this module : sig
... (* contents of the mli file *)
end =
struct
...
end

I couldn't find the syntax to do it though. Is it even possible?

You'd have to do the following. I really don't know why this is "easier", maybe you should give a few more details to point you in the right direction.

module X : sig ... end = 
  struct
    ...
  end
include X

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM