Hi David,<br><br><div class="gmail_quote">2011/6/21 <span dir="ltr"><<a href="mailto:dm-list-haskell-prime@scs.stanford.edu">dm-list-haskell-prime@scs.stanford.edu</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
At Tue, 21 Jun 2011 10:01:24 +0200,<br>
<div class="im">José Pedro Magalhães wrote:<br>
><br>
> | One thing you could do to help in this specific case would be to use a<br>
> | different M1 tag--e.g., M1 S ... for selectors and M1 NS ... for<br>
> | fields without selectors (or K1 NS). I presume you've already<br>
> | considered this and/or it's too late to make such a change. (Or to<br>
> | move the distinction up to the constructor with two different<br>
> | constructor tags, CR and CN for record and no-record.)<br>
><br>
> I don't think it's too late to make a change. The stuff has only just<br>
> gone in, so it's still very malleable. There may be other considerations,<br>
> but legacy code isn't one of them!<br>
><br>
> I suppose that could be changed, yes, but what exactly are we trying to solve<br>
> here? One can already specify different behavior for constructors with/without<br>
> named fields. Are we trying to avoid OverlappingInstances? Then yes, this<br>
> might help, but I'm not sure this change alone would make all generic<br>
> programming possible without OverlappingInstances.<br>
<br>
</div>Sorry, I wasn't necessarily advocating the change. This came out of a<br>
long discussion of UndecidableInstances. Oleg's TYPEOF approach is<br>
one way to avoid them (or at least to avoid them in conjunction with<br>
OverlappingInstances). Before Oleg posted his examples, Simon asked<br>
if it might be possible to use the new Generic class in a similar way.<br>
I was pointing out that no you can't, though the specific example I<br>
gave could be accommodated by a small change to the Generic interface.<br></blockquote><div><br>Ah, I see. Oleg's TYPEOF encodes only the type arguments to a datatype, whereas Rep encodes the structure of the datatype. As far as I can tell, TYPEOF never depends on the right-hand side of the datatype. A simple example is some datatype with a phantom type, say `data P a = P`. TYPEOF will encode the `a`, whereas Rep will not.<br>
<br>So now it is very clear to me that you cannot get the TYPEOF if you have the Rep, in general.<br><br><br>Cheers,<br>Pedro<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<font color="#888888"><br>
David<br>
</font></blockquote></div><br>