A while ago I grumbled about pretty printing of types in PolyML. I have just managed to condense my code into a sensibly viewable example which illustrates what I think the problem is:
signature N = sig type T end;
signature A = sig type T structure Ns : N sharing type Ns.T = T val mk : T val afoo : T -> T end;
signature B = sig include A val bfoo : T -> T end;
structure As : A = struct structure Ns = struct type T = string; end; type T = string val mk = "*" fun afoo s = s ^ "a"; end;
structure Bs : B = struct open As; fun bfoo s = s ^ "b"; end;
structure SafeBs :> B = Bs;
Observe the output from PolyML for the signature SafeBs. It prints it out wrongly. And I think this is to do with the sharing constraint: without it, I get what I expect:
structure SafeBs : sig structure Ns : N type T val afoo : SafeBs.T -> SafeBs.T val bfoo : SafeBs.T -> SafeBs.T val mk : SafeBs.T end
However, with the sharing constraint, I get:
structure SafeBs : sig structure Ns : N type T val afoo : A.T -> A.T val bfoo : A.T -> A.T val mk : A.T end
I think, given that SafeBs is hiding the types, printing A.T is very confusing, one might even be tempted to say wrong.
I would ideally like to have some programmatic control over the printing; perhaps choosing the left or right hand side of the last sharing constraint to be the name of the type that it printed.
would be lovely if this was easy to fix - it would help my understanding of type errors enormously! :)
cheers, lucas