Thanks Julien for your reply.<div><br></div><div>I played a little with this and found that we can create typeclass constraints on a type in case that we use existential types, such that we can get working code roughly equivalent of my first code:</div>
<div><br></div><div><div>:- module tc1.</div><div><br></div><div>:- interface.</div><div><br></div><div>:- import_module io.</div><div><br></div><div>:- pred main(io::di, io::uo) is det.</div><div><br></div><div>:- implementation.</div>
<div><br></div><div>:- import_module int.</div><div><br></div><div>:- typeclass a(T) where [</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>func aaa(T) = T</div><div>].</div><div><br></div><div>:- instance a(int) where [</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>aaa(E) = E+1 </div><div>].</div><div><br></div><div>:- type q ---> some [T] q(T) => a(T).</div><div><br></div><div>z(q(T)) = aaa(T).</div><div><br></div>
<div>main --> print(z('new q'(123))).</div><div><br></div><div>===</div><div><br></div><div><div>$ tc1</div><div>124</div></div><div><br></div><div>Now my question is: are the two approaches REALLY equivalent? Or should the (not yet implemented) approuch give us some fundamentally new means in programming with mercury?</div>
<div><br></div><div><br></div><div>Thank you.</div><br><div class="gmail_quote">On Thu, Feb 10, 2011 at 8:40 AM, Julien Fischer <span dir="ltr"><<a href="mailto:juliensf@csse.unimelb.edu.au">juliensf@csse.unimelb.edu.au</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
Hi,<br>
<br>
On Mon, 7 Feb 2011, Vladimir Gubarkov wrote:<br>
<br>
...<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Have you considered this feature useless/hard to implement?<br>
</blockquote>
<br></div>
Neither; it's just this particular feature is not very high on the list<br>
of features to implement given the amount of developer time available.<br>
<br>
Julien.<br>
--------------------------------------------------------------------------<br>
mercury-users mailing list<br>
Post messages to: <a href="mailto:mercury-users@csse.unimelb.edu.au" target="_blank">mercury-users@csse.unimelb.edu.au</a><br>
Administrative Queries: <a href="mailto:owner-mercury-users@csse.unimelb.edu.au" target="_blank">owner-mercury-users@csse.unimelb.edu.au</a><br>
Subscriptions: <a href="mailto:mercury-users-request@csse.unimelb.edu.au" target="_blank">mercury-users-request@csse.unimelb.edu.au</a><br>
--------------------------------------------------------------------------<br>
</blockquote></div><br></div>