[MLton] combining signatures
Michael Norrish
Michael.Norrish at nicta.com.au
Sun Jun 5 17:28:14 PDT 2011
If I have
signature One =
sig
eqtype foo
val op1 : foo -> ...
val op2 :
val op3 :
end
signature Two =
sig
eqtype foo
type bar
val op4 : bar -> foo
val op5 : ...
end
is it possible to create a signature that merges One and Two without retyping all of the bindings?
It'd be nice to be able to do
signature Combined =
sig
include One
include Two
end
but, reasonably, there is a complaint about duplicate bindings of foo.
In my situation, it would be OK to have a combined signature where a particular instance of foo was already decided on, but
signature Combined =
sig
include One where type foo = int
include Two where type foo = int
end
is also rejected.
I know I can do
signature Combined =
sig
structure One : One
structure Two : Two where type foo = One.foo
end
but this isn't quite the same. Is there any way of lifting the internal One and Two bindings out to the top-level to create the signature I really want?
If there's some not-too-destructive way of rewriting the One and Two signatures to make subsequent combination work, I'd be on for that too.
Michael.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 554 bytes
Desc: OpenPGP digital signature
Url : http://mlton.org/pipermail/mlton/attachments/20110606/88ea413a/signature.pgp
More information about the MLton
mailing list