Suppose I have a function list_fun : int_list -> string list
and in that function I use a StringSet
that I define as module StringSet = Set.Make(String)
. I try to have the function return Set.elements s
and get a string list
but instead I get a StringSet.elt list
which is supposed to be the same thing, as the StringSet
's type t = string
How do you make OCaml understand that these types are identically defined? I have several cases where I have come across this issue as I have started using the OCaml standard library functions.
OCaml already knows that they are identically defined - unless you're doing something strange to hide the types behind an abstraction, it will treat a StringSet.elt list
and string list
as the same type.