I’m wondering how to create a type alias for a type of the same name. This problem arises in the following scenario:
type t = A | B
module M = struct
type t = t (* Error: The type abbreviation t is cyclic *)
end
A solution is to create a t'
alias:
type t = A | B
type t' = t
module M = struct
type t = t' (* works *)
end
Is there a better (clearer) solution which wouldn’t involve creating an extra type alias? I vaguely remember that there might be a clean solution but I couldn’t find it.