We can pack module to value and unpack it back to module (modules as first-class citizens). Also, we can pack module type to type, but... Is it possible to unpack module type from type? If it is - How? If it is not - Why? The following sketch shows what I mean.
module type S = sig
type t
end
type 'a t = (module S with type t = 'a)
module type S' = sig
include SIG_FROM ( int t )
end
or
module type S'' = SIG_FROM ( int t )
Added Note:
So why I am asking about it. Very often Ocaml can't infer the type of the first-class module instance and it should be annotated. It is possible to do in two ways:
1) by signature
module type INTERNAL_S =
EXTERNAL_S with type a = char
and type b = int
and type c = string
let f (module M : INTERNAL_S) a b c =
M.f a b (c * 2)
2) by type
type e =
( module EXTERNAL_S
with type a = char
and type b = int
and type c = string
)
let f ((module M) : e) a b =
M.f a (b * 2)
As common second way is shorter and easy to read especially in signatures (.mli).
val g : (module INTERNAL_S) -> (module INTERNAL_S) ->
char -> int -> string
val g : e -> e -> char -> int -> string
And we create types from module types to simplify code reading or in the case when it is necessary (for example when it is expected by functor). And some-time I need type only but have to declare module type too because the support of constraining new types from module types are limited

and constraining new types (bound to module type) from types (bound to module types) is missing.
(* this kind of constructing is possible *)
let x : 'a t = (module struct
include A
include B
include (val C.some_value)
let new_f o = o
end)
(* but this isn't *)
type 'a t = (module sig
include A with type t = t
include B with type t := t
include SIG_FROM ( (int, int) sig_type )
val new_f : t -> t
end)
As for me, this way back makes modules more first-class.
Also, it is symmetric with the relationship between instances and modules (as I understand let x = (module X) and let module X = (val x) are also bindings). Symmetry - it is good (for example it partially exists between function and functors). But as I see in this place OCaml has a border between module language and core language. I asked "how" because have hope and ask "why" because sure that this question was opened in the design process of OCaml, so this border is based on some decisions and reasons.