Wow! Thank you very much! I don't know why I could not find it.

18:40, 11 октября 2019 г., Thierry Martinez <thierry.martinez@inria.fr>:

Hello, Vadim!

Vadim:

 Hello! I'm trying to figure out how shadow/override nested modules in
 OCaml.


A generic solution for old OCaml versions (<4.08) has been explained by
Gabriel Scherer in the following blog post:
http://gallium.inria.fr/blog/overriding-submodules/

The idea is to use destructive substitution while including the original
Ipaddr:
http://caml.inria.fr/pub/docs/manual-ocaml-4.01/extn.html#sec234

module Ipaddr = struct
  include (Ipaddr : module type of Ipaddr with module Prefix := Ipaddr.Prefix)
  ...
end

But I guess that the code you posted should work just fine with OCaml >=4.08
thanks to the following change:
https://github.com/ocaml/ocaml/pull/1892

Best regards.

--
Thierry Martinez.