combining signatures
Michael Norrish <[email protected]> Mon, 06 Jun 2011 10:28:14 +1000
| Newsgroups | gmane.comp.lang.ml.mlton.devel |
|---|---|
| Message-ID | <[email protected]> |
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.
_______________________________________________
MLton mailing list
[email protected]
http://mlton.org/mailman/listinfo/mlton
signature.asc
(application/pgp-signature, 554 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJN7B8iAAoJEGKGQ6ej3R2RtMcIALrG3a3vjUuElbowRa/GaeME 9aFC8HBjNfdhqEMx30UrosPbYiBKGSe26YF7tQV1LAsGY//qaIMk6zH+64dD5YWY 41qiACbcWCznCvYXfYuo/LIbjhmVDRL1EXPcelqc/3prdnTxrMWK25ruE6r4k7Wm kOydTSrI+zRPh9qIWxzoQsoRzFs/vFsYh4bU0iKLq9E48qj3U54yWuaGwfAJqq7c 8Q0gCuMUW82vtC7x+0M2QAFqhJIQKoTG3IXwaJDlltyr68lO/2FDESBi7MC9dOtz atiVwzqXyVJIHZzP3gTCucjIGtEdaf9Z8+RZNqYhf0EFPmXSGdS0El0cC/jLwR0= =sXTQ -----END PGP SIGNATURE-----