or, “Is there any way to transparently wrap a module used by a dependency of yours, with a replacement module with compatible types?”
A concrete example: let’s say I wanted to modify the implementation of
Cohttp_async.Client.post to add an additional header, no matter where it’s called from (including from code I don’t control; such as when it’s called by the
(At the moment, the only way I can think of, is to actually modify the package in question, and add that modified package to our own opam mirror? That’s significantly untenable in practice; as in reality, there will be several HTTP libraries that will need wrapping — as well as dozens, or hundreds, of intermediate libraries that call into those various HTTP libraries.)
to avoid an xyproblem.info:
I’m doing a lot of work with OpenTelemetry; one of the core concepts therein is a W3C Trace Context header that needs to be propagated through one’s application, from in-bound HTTP requests, onwards to out-bound HTTP requests.
In OCaml, with much less dynamism, this is a significantly more difficult problem. /=