<div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">> Thank you Atze for a well-written description.</span><br><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Cheers! :)</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">> </span><span style="font-family:arial,sans-serif;font-size:13px">I think there might be a couple of typos there?</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Sadly, due to the </span><font face="arial, sans-serif">finiteness of life I cannot guarantee perfection in all my communication. However, if you see typos, I would greatly appreciate it if you fix them (it's a wiki). :)</font></div>
<div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">> </font><span style="font-family:arial,sans-serif;font-size:13px">    (c, r'') = decomp r x      -- rhs s/b: decomp r' x ??</span></div>
<span style="font-family:arial,sans-serif;font-size:13px">> Your "motivation" example is hard to follow without knowing what `decomp`</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">> does. (IOW, it is not showing me a motivation ;-)</span><div>
<span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Woops! Sorry! I messed up the example, i've changed it now to:</span></div><div>
<span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><pre class="" style="margin-top:0px;margin-bottom:0px;padding:0px;line-height:1.2em;overflow:auto;background-image:none;border:0px none white;font-size:medium;vertical-align:top;color:rgb(0,0,0)">
g <span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">::</span> Rec r <span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">-></span> Rec <span class="" style="margin:0px;padding:0px;color:green">(</span><span class="" style="margin:0px;padding:0px;background-color:rgb(60,179,113);color:rgb(221,17,68)!important">"p"</span> <span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">::=</span> <span class="" style="margin:0px;padding:0px;color:rgb(204,204,0);font-weight:bold">String</span> <span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">.|</span> r<span class="" style="margin:0px;padding:0px;color:green">)</span>
g r <span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">=</span> <span class="" style="margin:0px;padding:0px;font-weight:bold;color:rgb(0,102,204)">let</span> r' <span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">=</span> f <span class="" style="margin:0px;padding:0px;color:green">(</span>x :<span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">=</span> 10 <span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">.|</span> r<span class="" style="margin:0px;padding:0px;color:green">)</span>
          <span class="" style="margin:0px;padding:0px;color:green">(</span>c<span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">,</span>r''<span class="" style="margin:0px;padding:0px;color:green">)</span> <span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">=</span> <span class="" style="margin:0px;padding:0px;color:green">(</span>r'<span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">.!</span>x<span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">,</span> r' <span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">.-</span> x<span class="" style="margin:0px;padding:0px;color:green">)</span>
          v <span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">=</span> <span class="" style="margin:0px;padding:0px;font-weight:bold;color:rgb(0,102,204)">if</span> c <span class="" style="margin:0px;padding:0px;font-weight:bold;color:rgb(0,102,204)">then</span> <span class="" style="margin:0px;padding:0px;background-color:rgb(60,179,113);color:rgb(221,17,68)!important">"Yes"</span> <span class="" style="margin:0px;padding:0px;font-weight:bold;color:rgb(0,102,204)">else</span> <span class="" style="margin:0px;padding:0px;background-color:rgb(60,179,113);color:rgb(221,17,68)!important">"Nope"</span>
      <span class="" style="margin:0px;padding:0px;font-weight:bold;color:rgb(0,102,204)">in</span> p :<span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">=</span> v <span class="" style="margin:0px;padding:0px;color:rgb(51,153,51);font-weight:bold">.|</span> r''</pre>
<pre class="" style="margin-top:0px;margin-bottom:0px;padding:0px;line-height:1.2em;overflow:auto;background-image:none;border:0px none white;font-size:medium;vertical-align:top;color:rgb(0,0,0)"><br></pre><pre class="" style="margin-top:0px;margin-bottom:0px;padding:0px;line-height:1.2em;overflow:auto;background-image:none;border:0px none white;font-size:medium;vertical-align:top;color:rgb(0,0,0)">
> <span style="font-family:arial,sans-serif;font-size:13px;line-height:normal;color:rgb(34,34,34)">I'm puzzled by this in the implementation notes 4.2 Records:</span></pre><span style="font-family:arial,sans-serif;font-size:13px">> "Here we see that a record is actually just a map from string to the</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">> sequence of values. Notice that it is a sequence of values and not a</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">> single value, because the record may contain duplicate labels."</span><br style="font-family:arial,sans-serif;font-size:13px">
<br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">> It sounds like there's an overhead in being able to support duplicate</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">> labels (even if I don't want duplicates in my records)?</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">> Is there a performance penalty at run-time with extending/prepending and</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">> restricting/pretruncating, to keep the invariant re the i-th value?</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">Well, supposing you have no duplicate labels, then all sequences are of length 1. </span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Hence the overhead is that we have a sequence of length 1 instead of just a value (i.e. one extra reference to follow).</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px">This is a very small overhead, and in my opinion is justified by the advantages of allowing duplicate labels.</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Notice also that (.!) always accesses the head of the sequence, since only the leftmost label is accessible (to access shadowed labels, restrict the record with that label).</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">> Leijen allowed duplicate labels to make a virtue of necessity IMO. There</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">> has not been an extensible records proposal before or since for duplicate</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">> labels. (TRex certainly didn't do it.) His 'necessity' was ease of</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">> implementation.</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">> This sequence of values stuff seems to make a more difficult</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">> implementation for the sake of providing a 'feature' that nobody's asked</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">> for(?)</span><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><font face="arial, sans-serif">Well, I think Leijen makes two points: </font></div><div>* Duplicate labels are nice and allow shadowing in records, which is good.</div>
<div>* Duplicate labels allow us to construct a type system lacking a "lacks" predicate, which makes it simpler.</div><div><br></div><div>I am mainly interested in the first point, see my example. As I said, whether you want duplicate labels depends on the situation. </div>
<div><br></div><div><div>As another use case for duplicate labels: consider implementing an interpreter for some embedded DSL, and you want to carry the </div><div>state of the variables in the an extensible record. Declaring a new variable in the embedded language then</div>
<div>causes us to extend the record. Since the embedded language allows shadowing (as most languages do), we can simply</div><div>extend the record, we do not have to jump through hoops to make sure there are no duplicate labels. Once the variable</div>
<div>goes out of scope, we remove the label again to bring the old "variable" into scope.</div></div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">> </span><span style="font-family:arial,sans-serif;font-size:13px">Actually, I think there's more wrong with that line than a typo:</span></div>
<div class="im" style="font-family:arial,sans-serif;font-size:13px">><br>>     extendUnique :: (..., l :\r ) => ...<br>>                   -- s/b: r :\ l  ??<br>><br></div><span style="font-family:arial,sans-serif;font-size:13px">> (It's supposed to do renaming with non-duplicate labels?)</span><div>
<br></div><div><span style="font-family:arial,sans-serif">Sorry! Another mistake, I've fixed it. It is now as follows:</span></div><div><br></div><div><span class="" style="color:rgb(153,0,0);font-weight:bold;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">renameUnique</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">::</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">(</span><span class="" style="color:rgb(68,85,136);font-weight:bold;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">KnownSymbol</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">l</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">,</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(68,85,136);font-weight:bold;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">KnownSymbol</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">l'</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">,</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">r</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(68,85,136);font-weight:bold;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">:\</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">l'</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">)</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">=></span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(68,85,136);font-weight:bold;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">Label</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">l</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">-></span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(68,85,136);font-weight:bold;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">Label</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">l'</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">-></span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(68,85,136);font-weight:bold;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">Rec</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">r</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="font-weight:bold;color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">-></span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(68,85,136);font-weight:bold;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">Rec</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">(</span><span class="" style="color:rgb(68,85,136);font-weight:bold;font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">Rename</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">l</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">l'</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre"> </span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre;background-color:rgb(255,255,255)">r</span><span class="" style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;line-height:18px;white-space:pre">)</span></div>
<div><font color="#333333" face="Consolas, Liberation Mono, Courier, monospace"><span style="font-size:12px;line-height:18px;white-space:pre"><br></span></font></div><div><br></div><div><span style="font-family:arial,sans-serif;font-size:13px">> Talking of renaming, how does it go with duplicate labels?</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">> The comment on `rename` says it can be expressed using the "above</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">> operations" (presumably restrict followed by extend with the new label, as</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">> per Gastar&Jones and Leijen).</span><br style="font-family:arial,sans-serif;font-size:13px"><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">> If that's genuinely equivalent, then rename will 'unhide' any duplicate</span><br style="font-family:arial,sans-serif;font-size:13px">
<span style="font-family:arial,sans-serif;font-size:13px">> label. So presumably the implementation must split the HashMap into two</span><br style="font-family:arial,sans-serif;font-size:13px"><span style="font-family:arial,sans-serif;font-size:13px">> keys, rather than changing the label on the existing Seq(?)</span><div>
<br></div><div><div><span style="font-family:arial,sans-serif;font-size:13px">Yes, exactly. Renaming is implemented as follows, which is equivalent to what you said:</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><pre style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51);line-height:18px"><div class="" id="LC155" style="padding-left:10px">
<span class="" style="color:rgb(153,0,0);font-weight:bold">rename</span> <span class="" style="font-weight:bold">::</span> <span class="">(</span><span class="" style="color:rgb(68,85,136);font-weight:bold">KnownSymbol</span> <span class="">l</span><span class="">,</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">KnownSymbol</span> <span class="">l'</span><span class="">)</span> <span class="" style="font-weight:bold">=></span> <span class="" style="color:rgb(68,85,136);font-weight:bold">Label</span> <span class="">l</span> <span class="" style="font-weight:bold">-></span> <span class="" style="color:rgb(68,85,136);font-weight:bold">Label</span> <span class="">l'</span> <span class="" style="font-weight:bold">-></span> <span class="" style="color:rgb(68,85,136);font-weight:bold">Rec</span> <span class="">r</span> <span class="" style="font-weight:bold">-></span> <span class="" style="color:rgb(68,85,136);font-weight:bold">Rec</span> <span class="">(</span><span class="" style="color:rgb(68,85,136);font-weight:bold">Rename</span> <span class="">l</span> <span class="">l'</span> <span class="">r</span><span class="">)</span></div>
<div class="" id="LC156" style="padding-left:10px"><span class="" style="color:rgb(153,0,0);font-weight:bold">rename</span> <span class="">l</span> <span class="">l'</span> <span class="">r</span> <span class="" style="font-weight:bold">=</span> <span class="">extend</span> <span class="">l'</span> <span class="">(</span><span class="">r</span> <span class="" style="font-weight:bold">.!</span> <span class="">l</span><span class="">)</span> <span class="">(</span><span class="">r</span> <span class="" style="font-weight:bold">.-</span> <span class="">l</span><span class="">)</span></div>
<div class="" id="LC159" style="padding-left:10px"><span class="" style="color:rgb(153,0,0);font-weight:bold">renameUnique</span> <span class="" style="font-weight:bold">::</span> <span class="">(</span><span class="" style="color:rgb(68,85,136);font-weight:bold">KnownSymbol</span> <span class="">l</span><span class="">,</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">KnownSymbol</span> <span class="">l'</span><span class="">,</span> <span class="">r</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">:\</span> <span class="">l'</span><span class="">)</span> <span class="" style="font-weight:bold">=></span> <span class="" style="color:rgb(68,85,136);font-weight:bold">Label</span> <span class="">l</span> <span class="" style="font-weight:bold">-></span> <span class="" style="color:rgb(68,85,136);font-weight:bold">Label</span> <span class="">l'</span> <span class="" style="font-weight:bold">-></span> <span class="" style="color:rgb(68,85,136);font-weight:bold">Rec</span> <span class="">r</span> <span class="" style="font-weight:bold">-></span> <span class="" style="color:rgb(68,85,136);font-weight:bold">Rec</span> <span class="">(</span><span class="" style="color:rgb(68,85,136);font-weight:bold">Rename</span> <span class="">l</span> <span class="">l'</span> <span class="">r</span><span class="">)</span></div>
<div class="" id="LC160" style="padding-left:10px"><span class="" style="color:rgb(153,0,0);font-weight:bold">renameUnique</span> <span class="" style="font-weight:bold">=</span> <span class="">rename</span></div><div><span class=""><br>
</span></div></pre></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/6 AntC <span dir="ltr"><<a href="mailto:anthony_clayden@clear.net.nz" target="_blank">anthony_clayden@clear.net.nz</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">> Atze van der Ploeg <atzeus <at> <a href="http://gmail.com" target="_blank">gmail.com</a>> writes:<br>

><br>
</div><div class="im">> (see <br>
<a href="http://www.haskell.org/haskellwiki/CTRex#Duplicate_labels.2C_and_lacks" target="_blank">http://www.haskell.org/haskellwiki/CTRex#Duplicate_labels.2C_and_lacks</a>).<br>
> I think duplicate labels are nice in some situations and bad in other<br>
situations. <br>
><br>
<br>
</div>Thank you Atze for a well-written description.<br>
<br>
I think there might be a couple of typos there?<br>
<br>
    (c, r'') = decomp r x      -- rhs s/b: decomp r' x ??<br>
<br>
    extendUnique :: (..., l :\r ) => ...<br>
                  -- s/b: r :\ l  ??<br>
<br>
Your "motivation" example is hard to follow without knowing what `decomp`<br>
does. (IOW, it is not showing me a motivation ;-)<br>
<br>
I'm puzzled by this in the implementation notes 4.2 Records:<br>
"Here we see that a record is actually just a map from string to the<br>
sequence of values. Notice that it is a sequence of values and not a<br>
single value, because the record may contain duplicate labels."<br>
<br>
It sounds like there's an overhead in being able to support duplicate<br>
labels (even if I don't want duplicates in my records)?<br>
Is there a performance penalty at run-time with extending/prepending and<br>
restricting/pretruncating, to keep the invariant re the i-th value?<br>
<br>
Leijen allowed duplicate labels to make a virtue of necessity IMO. There<br>
has not been an extensible records proposal before or since for duplicate<br>
labels. (TRex certainly didn't do it.) His 'necessity' was ease of<br>
implementation.<br>
This sequence of values stuff seems to make a more difficult<br>
implementation for the sake of providing a 'feature' that nobody's asked<br>
for(?)<br>
<br>
<br>
There's one 'advanced feature' of extensible records that I'd be<br>
interested in: merging records by label, as is done for 'Natural Join'.<br>
<br>
    a row with labels {x, y, z} merge labels {y, z, w}<br>
    returns a Maybe row with {x, y, z, w}<br>
    providing the types paired with y and z are the same<br>
    and the values are the same<br>
    (otherwise return Nothing)<br>
<br>
It's absolutely essential _not_ to duplicate labels in this case.<br>
<div class="HOEnZb"><div class="h5"><br>
AntC<br>
<br>
<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br></div>