[MLton] withtype in signature?

Matthew Fluet fluet@cs.cornell.edu
Thu, 15 Sep 2005 11:28:07 -0400 (EDT)


> 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.

I don't believe that there is any way to use 'sharing type' or 'where 
type' to produce an independent signature BAR that relates the types in 
your intended manner.  You can use 'where type' to expose the types by 
relating them to a concrete instantiation:

local
   structure Bar : BAR = struct ... end
   type t = Bar.t
in
   structure Bar :> BAR where type t = t
                        and type foo = string * t
                        and type baz = int        = Bar
end