<p>Maybe this article can interest you:<br>
<a href="http://lukepalmer.wordpress.com/2010/01/24/haskell-antipattern-existential-typeclass/">http://lukepalmer.wordpress.com/2010/01/24/haskell-antipattern-existential-typeclass/</a></p>
<p>I think a record syntax is probably the best match, the biggest mismatch between your approach and the haskell way might be the haskell preference for immutability.</p>
<p>Maybe you should check how such things are implemented in existing gui libraries in haskell.</p>
<p>emmanuel</p>
<div class="gmail_quote">On 18 Mar 2013 19:12, &quot;Răzvan Rotaru&quot; &lt;<a href="mailto:razvan.rotaru@gmail.com">razvan.rotaru@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><br><br><div class="gmail_quote">On 18 March 2013 18:34,  <span dir="ltr">&lt;<a href="mailto:beginners-request@haskell.org" target="_blank">beginners-request@haskell.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Not directly, no. It is possible to use existentials to do this ? at the<br>
cost that you lose the ability to do anything but what you have declared<br>
about it. For example, if you were to use this to make a map of Show-able<br>
values, the *only* thing you can do with the value is invoke &quot;show&quot; on it<br>
(in particular: you cannot pull out the value directly, because the only<br>
thing you know about it is that &quot;show&quot; works on it; you otherwise have no<br>
idea what it is!). And with such a value, referential transparency means<br>
there is no difference between this and storing the *result* of invoking<br>
&quot;show&quot; on it (that is, a String) instead, and laziness means that it may<br>
well actually store a thunk that will invoke &quot;show&quot; when the value is<br>
needed instead of computing and storing the value, so that there is in fact<br>
no difference between the two except that the type is much more complicated<br>
and both the type and the code are correspondingly more difficult to<br>
understand.<br>
<br>
What problem are you trying to solve by obfuscating things in this manner?<br>
<br>
Also note that most times when someone is trying to do this, they have<br>
confused typeclasses with OOP; they are not, and trying to treat them as<br>
such *will* lead you into dead ends.<br>
<br></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
--<br>
brandon s allbery kf8nh                               sine nomine associates<br>
<a href="mailto:allbery.b@gmail.com" target="_blank">allbery.b@gmail.com</a>                                  <a href="mailto:ballbery@sinenomine.net" target="_blank">ballbery@sinenomine.net</a><br>
unix, openafs, kerberos, infrastructure, xmonad        <a href="http://sinenomine.net" target="_blank">http://sinenomine.net</a><br></blockquote><div><br><div>Well, I need something similar to Java interfaces. Or at least this is my current way of thinking about the problem. I am trying to build some types for GUI Widgets, and I would like to use Maps to keep their properties. It&#39;s meant to replace the record syntax, which I find unusable because of the name clash. I also would like to have fast non-destructive update of this type, by using structural sharing, and Maps as good for this.<br>

<br>So, for example a Button would have an id, a label and function for the onclick event, and these three values should be kept in a map, with the keys &quot;id&quot;, &quot;label&quot; and &quot;onclick&quot;.<br><br></div>

<div>It&#39;s true that keeping Show-able values is not enough, since I won&#39;t be able to call the onclick function. Unfortunately, I have no idea how to do this as well.<br></div></div></div><br></div><div class="gmail_extra">

Razvan<br></div></div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div>