[MLton] withtype in signature?
   
    Wesley W. Terpstra
     
    wesley@terpstra.ca
       
    Tue, 13 Sep 2005 10:59:58 +0200
    
    
  
On Sep 6, 2005, at 7:30 PM, Stephen Weeks wrote:
> The way I typically work around the absence of withtype in signatures
> is to make all the withtypes be datatypes.  That is,
>
>   datatype test = A of foo * baz | B
>   and foo = Foo of string * test
>   and baz = Baz of int
That is indeed a useful trick.
However, for my purposes it doesn't work because the code output
is auto-generated and isn't allowed to introduce constructors.
If I am writing code by hand and have this problem, this is definitely
the solution I will use.
>   type test'
>   type foo = string * test'
>   type baz = int
>   datatype test = A of foo * baz | B
>   sharing type test = test'
The above got me thinking. Here's what I eventually used:
signature BAR =
   sig
     type foo
     type baz
     datatype test = A of foo * baz | B
   end
Then I use transparent signature ascription.
Is there any way to get 'sharing type' or 'where type' to do the work?
If not, what I have is workable: no identifiers in the public namespace.