How to return the instance of first-class module's nested type from a function?
问题 Context: I am trying to implement something like OOP observable pattern in OCaml with using first-class modules. I have a project with a list of modules and want to extend them with observation without changing. To minimize code duplication I created Subject module and plan to use it as a part of the common way (in the project context) for this extending. I declared three module types: OBSERVER: module type OBSERVER = sig type event type t val send : event -> t -> t end OBSERVABLE: module