first-class-modules

How to return the instance of first-class module's nested type from a function?

∥☆過路亽.° 提交于 2020-06-16 18:36:35
问题 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

How to return the instance of first-class module's nested type from a function?

百般思念 提交于 2020-06-16 18:36:16
问题 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

How to return the instance of first-class module's nested type from a function?

不羁的心 提交于 2020-06-16 18:36:07
问题 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