I am running into a bit of a code duplication issue. I have a module with a signature (mostly to hide the implementation of
type t) and I want one of the functions to return a curried function but I don’t want to copy-paste the signature. This is to 1) avoid duplication and 2) to allow the signature to change in the future without breaking my signature (changing it is fine).
Here’s an example:
module My : sig type t val make : t -> [%please partially apply Uri.make] end = struct type t = string let make t = Uri.make ~host:t end
To make this type I would need to copy the entirety of
Uri.make signature into my own signature, even despite me not caring at all what other arguments
Uri.make takes — in fact I want the caller to get access to all the left-over arguments.
Is there any way I can do that in a straightforward way?
The only thing I can think of is to change my
make function to take an additional argument
(~host:string -> 'a -> 'b) but then the caller has to supply
Uri.make by themselves which is… somewhat tedious.