I have a very large signature with two abstract types:
signature GENERAL_FOO_BAR =
sig
type foo
type bar
(* lots of stuff here *)
end
I want to declare a subsignature of GENERAL_FOO_BAR
, where the two abstract types are identified, but none of the following attempts works:
signature SPECIAL_FOO_BAR = GENERAL_FOO_BAR
where type foo = bar
signature SPECIAL_FOO_BAR = GENERAL_FOO_BAR
sharing type foo = bar
It would be very cumbersome to use a dummy type as follows:
signature SPECIAL_FOO_BAR =
sig
type both
include GENERAL_FOO_BAR
where type foo = both
where type bar = both
end
Since it forces anyone who wants to implement SPECIAL_FOO_BAR
to, well, define the dummy type. Is there a better alternative?
You don't need to be so explicit about "subsignatures". Here is a simple example of "subsignatures":
signature F =
sig
type foo
type bar
end
signature G =
sig
type foo = int
type bar = string
end
structure C : G =
struct
type foo = int
type bar = string
end
structure D : F = C