I am creating two libraries in OCaml that contain the same option. The detail of the variant is not very important, except that it is really large, and it would be unpleasant to manually write conversion functions for it. (This is actually a bfd_architecture enum converted from C using ocamlidl).
Now I am writing a program using two libraries. In particular, I call Af, which returns the value A.variant_type, and I need to use this value in a call to Bg, which takes the value B.variant_type as input.
Is it possible to tell OCaml that A.variant_type and B.variant_type are really the same type, and thus it is possible to convert a value from one to another? Libraries are independent, therefore they should not refer to each other. Right now I'm using Obj.magic to convert, but this is a hack.
source share