Given a signature A with data type t , say
signature A = sig datatype t = T of int | S of string end
Is it possible to provide an implementation (structure) that does not have t repeated? For example, in the next signature, the definition of t repeated. This is great for small data types, but a bit awkward for large ones.
structure AImpl : A = struct datatype t = T of int | S of string end
My intention is simply to give an interface so that all announcements can be recognized. But I do not want each implementation to repeat the definition of a data type.
Although it seems that the signature and structure may include a data type from another structure, then it would be impossible to recognize the data type declaration only by checking the signature. For instance:
structure AData = struct datatype t = T of int | S of string end signature A = sig datatype t = datatype AData.t end structure a : A = struct open AData end
Of course, this approach, although not the one that satisfies, is acceptable if I put both AData and A in the same .sig file.
source share