<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Ziv: thank you for this suggestion. Note that I have raised an issue on UrLib on an unrelated matter.<br>
<br>
After some head-scratching, I got as far as:<br>
<br>
    fun update_ab [write] (sub : Subset.t [A=int,B=int] write) (w : $write) =<br>
        {A=1,B=2} --- write ++ w<br>
<br>
which also does not work. Any guidance here would be appreciated - I admit to being stuck after looking closely at UrLib's subset.ur(s) and magicTable.ur(s).<br>
<br>
Kindly, Mark.<br>
<br>
<div class="moz-cite-prefix">On 29/10/19 4:39 pm, Ziv Scully wrote:<br>
</div>
<blockquote type="cite" cite="mid:CADK8yDQTdxBazJw4T99O0nQFieFLMqLB0eEhJ1XJfDyKg2dgiQ@mail.gmail.com">
<div>
<div dir="auto">One can capture subset constraints using a type class, as the following module does:</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">
<div><a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvizziv%2FUrLib%2Fblob%2Fmaster%2FUrLib%2Fsubset.urs&data=02%7C01%7Cmark.clements%40ki.se%7C46a639348ebc4f9a241108d75c865133%7Cbff7eef1cf4b4f32be3da1dda043c05d%7C0%7C0%7C637079604764017394&sdata=ueZ7e9P7Rzqhq7P4vuBDpbcq8QbIYA5i8vhL9%2BgCvEc%3D&reserved=0" originalsrc="https://github.com/vizziv/UrLib/blob/master/UrLib/subset.urs" shash="ENvCGgqgBiJEpzDFfA8wU93l14msjvZkhKg4mk4NLPeKV20o77pdYiHcdCAJttUEFBn1YonQY7txSi8OJPQOMh2lOMXfvdUG/YL2z+rhsyk7iGxqxtcpI8rjN43l+Xl4yQHFh/BspKaMv0UVzwLaFLIegmY7M7+R0YyIuJNx6qs=" moz-do-not-send="true">https://github.com/vizziv/UrLib/blob/master/UrLib/subset.urs</a></div>
<div><a href="https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvizziv%2FUrLib%2Fblob%2Fmaster%2FUrLib%2Fsubset.ur&data=02%7C01%7Cmark.clements%40ki.se%7C46a639348ebc4f9a241108d75c865133%7Cbff7eef1cf4b4f32be3da1dda043c05d%7C0%7C0%7C637079604764027387&sdata=RDT9vPh4qegdK9iiBr%2F2K7vpFc4z%2BF2y4cHa2eDe5Tw%3D&reserved=0" originalsrc="https://github.com/vizziv/UrLib/blob/master/UrLib/subset.ur" shash="OD1d0jf3kirUYjrxphwMoQB5brjhic+y47P6xQ0aRIWyX+26cWjdYgu9u2EARjyF32CYK6AjlfNhXavDhXTKEVQE+FmkbKpCEWcuk9NkAIYz9YnS9zwjw4kSCgWLzF9TbRaPD/Sm82C1kAWCl0rsDkDgrrttifDFwgKQDCGOiDA=" moz-do-not-send="true">https://github.com/vizziv/UrLib/blob/master/UrLib/subset.ur</a></div>
<br>
</div>
<div dir="auto">(It relies on another module, Eq, from the same project.)</div>
<div dir="auto"><br>
</div>
<div dir="auto">Ziv</div>
<div dir="auto"><br>
</div>
<div><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, Oct 29, 2019 at 11:21 Mark Clements <<a href="mailto:mark.clements@ki.se" moz-do-not-send="true">mark.clements@ki.se</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
Adam: thank you for your prompt reply.<br>
<br>
To define defaultSettings properly, is there some way to constraint the<br>
type union (keep ++ change) to an existing type (e.g. {A:int, B:int})?<br>
The following also do not work:<br>
<br>
fun defaultSetting<br>
     [keep] [change] [keep ~ change]<br>
     (args : $change)<br>
     : $(keep ++ change) =<br>
     update {A=1, B=1} args<br>
<br>
(* or *)<br>
<br>
fun defaultSetting<br>
         [keep] [change] [keep ~ change]<br>
         (args : $change)<br>
     : $(keep ++ change) =<br>
     {A=1,B=1} --- change ++ args<br>
<br>
-- Mark<br>
<br>
On 29/10/19 12:52 am, Adam Chlipala wrote:<br>
> On 10/28/19 3:27 PM, Mark Clements wrote:<br>
>> fun defaultSetting args =<br>
>>       update {A=1, B=1} args<br>
>><br>
>> val _ = defaultSetting {A=2} (* {A=2, B=1} *)<br>
>> val _ = defaultSetting {B=2} (* {A=1, B=2} *)<br>
> The problem is that polymorphism in Ur/Web is always declared<br>
> explicitly, not inferred as OCaml or Haskell.  You must add binders<br>
> for type variables for defaultSettings just as you did for update.<br>
> (This statement applies to definitions of functions, not uses, so the<br>
> two example calls above should work once you get defaultSettings<br>
> defined properly.)<br>
<br>
<br>
<br>
När du skickar e-post till Karolinska Institutet (KI) innebär detta att KI kommer att behandla dina personuppgifter. Här finns information om hur KI behandlar personuppgifter<<a href="https://ki.se/medarbetare/integritetsskyddspolicy" rel="noreferrer" target="_blank" moz-do-not-send="true">https://ki.se/medarbetare/integritetsskyddspolicy</a>>.<br>
<br>
<br>
Sending email to Karolinska Institutet (KI) will result in KI processing your personal data. You can read more about KI’s processing of personal data here<<a href="https://ki.se/en/staff/data-protection-policy" rel="noreferrer" target="_blank" moz-do-not-send="true">https://ki.se/en/staff/data-protection-policy</a>>.<br>
_______________________________________________<br>
Ur mailing list<br>
<a href="mailto:Ur@impredicative.com" target="_blank" moz-do-not-send="true">Ur@impredicative.com</a><br>
<a href="https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.impredicative.com%2Fcgi-bin%2Fmailman%2Flistinfo%2Fur&data=02%7C01%7Cmark.clements%40ki.se%7C46a639348ebc4f9a241108d75c865133%7Cbff7eef1cf4b4f32be3da1dda043c05d%7C0%7C0%7C637079604764027387&sdata=DQN4vR4Qr7o7m6U4zF6BnCKBn%2B2pWf5TSdKv0nt5G60%3D&reserved=0" originalsrc="http://www.impredicative.com/cgi-bin/mailman/listinfo/ur" shash="XL4MjHM5my8WSS6Njwy2s6NfWsA4pYBW4nKUizdaI0qsU+glNJEKj9T54519EyxB7bsiRJPQi4o0TECfgczDvJUgHVyzfcFeLr9p3q+akqo7fMvwVBtXcXLe9RP/CJlGX5trZ1byHR8C0o3lRARo6/Y5QhuByd8HwFtaiOz+wLw=" rel="noreferrer" target="_blank" moz-do-not-send="true">http://www.impredicative.com/cgi-bin/mailman/listinfo/ur</a><br>
</blockquote>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Ur mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Ur@impredicative.com">Ur@impredicative.com</a>
<a class="moz-txt-link-freetext" href="https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.impredicative.com%2Fcgi-bin%2Fmailman%2Flistinfo%2Fur&amp;data=02%7C01%7Cmark.clements%40ki.se%7C46a639348ebc4f9a241108d75c865133%7Cbff7eef1cf4b4f32be3da1dda043c05d%7C0%7C0%7C637079604764057370&amp;sdata=PQE3WAaKAftQmRM4kIKJ%2B%2BiqJG%2F%2BAW9D8dHeJ8ab0WY%3D&amp;reserved=0">https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.impredicative.com%2Fcgi-bin%2Fmailman%2Flistinfo%2Fur&amp;data=02%7C01%7Cmark.clements%40ki.se%7C46a639348ebc4f9a241108d75c865133%7Cbff7eef1cf4b4f32be3da1dda043c05d%7C0%7C0%7C637079604764057370&amp;sdata=PQE3WAaKAftQmRM4kIKJ%2B%2BiqJG%2F%2BAW9D8dHeJ8ab0WY%3D&amp;reserved=0</a>
</pre>
</blockquote>
<br>
</body>
</html>