[Ur] Sharing types in signatures

Ziv Scully ziv at mit.edu
Fri Sep 30 21:17:36 EDT 2016


The relevant mechanism is `where`. Try something like the following.

signature A = sig type t end
signature B = sig type t end

structure C = sig
  structure A1 : A
  structure B1 : B where type t = A.t
end

This is especially useful for relating types in the input and output
signatures of functors:

functor F(A1 : A) : B where type t = A.t

You can do the same for any constructor using `where con` instead of `where
type`, and you can use multiple `where` statements on the same signature
one after the other.


On Fri, Sep 30, 2016 at 8:35 PM, Saulo Araujo <saulo2 at gmail.com> wrote:

> Hi,
>
> Does Ur/Web supports sharing types in signatures like in the code below?
>
> signature A = sig
>   type t
> end
>
> signature B = sig
>   type t
> end
>
> signature C = sig
>   structure A1 : A
>   structure B1 : B
>   sharing type A1.t = B1.t
> end
>
> In case it is not supported, is there a way to accomplish something
> similar?
>
> Sincerely,
> Saulo
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20160930/651cb8a9/attachment.html>


More information about the Ur mailing list