sfmatt
sfmatt

Reputation: 13

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?

Upvotes: 1

Views: 194

Answers (1)

nlucaroni
nlucaroni

Reputation: 47934

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

Upvotes: 1

Related Questions