<div dir="ltr">The simplest way generally is to make make a C binding and then bind Haskell from there. You may indeed want to take a look at wxWidgets&#39; binding or SFML&#39;s (<a href="https://github.com/jeannekamikaze/SFML">https://github.com/jeannekamikaze/SFML</a>).</div>

<div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 18, 2013 at 1:05 AM, kudah <span dir="ltr">&lt;<a href="mailto:kudahkukarek@gmail.com" target="_blank">kudahkukarek@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I&#39;d suggest to first look at how other C++-bindings for haskell are<br>
implemented. e.g. wxHaskell is the most mature Haskell C++ binding out<br>
there. hogre tries to generate bindings from headers. And a number of<br>
(rather minimal) bindings to some libs were made as part of Nikki and<br>
the Robots.<br>
<div class="HOEnZb"><div class="h5"><br>
On Thu, 17 Jan 2013 18:48:02 +0100 Nathan Hüsken<br>
&lt;<a href="mailto:nathan.huesken@posteo.de">nathan.huesken@posteo.de</a>&gt; wrote:<br>
<br>
&gt; Hey,<br>
&gt;<br>
&gt; I would like to write FII bindings in haskell for cocos2d-x<br>
&gt; (<a href="http://www.cocos2d-x.org/" target="_blank">http://www.cocos2d-x.org/</a>), which is a C++ library.<br>
&gt;<br>
&gt; Since I have little experience with this, I would like some feedback<br>
&gt; before I discover that concept is bad half way.<br>
&gt;<br>
&gt; In cocos2d there is a base class with much functionality: CCNode<br>
&gt; Many classes derive from it (i.E. CCLayer) and use the virtual<br>
&gt; functions of CCNode (i.E. setPosition).<br>
&gt;<br>
&gt; How do I map this to haskell?<br>
&gt;<br>
&gt; The general Idea:<br>
&gt;<br>
&gt; I have a typeclass, in which everything that is derived from CCNode is<br>
&gt; an instance:<br>
&gt;<br>
&gt;     class NodeDerived a where<br>
&gt;       toNode :: a -&gt; Node<br>
&gt;<br>
&gt;       setPosition :: a -&gt; (Double,Double) -&gt; IO ()<br>
&gt;       setPosition a pos = setNodePosition (toNode a) pos<br>
&gt;<br>
&gt;     instane NodeDerived Layer where<br>
&gt;       toNode = layerToNode<br>
&gt;<br>
&gt; and layerToNode :: Layer -&gt; Node would be implemented in C++ as:<br>
&gt;<br>
&gt;     CCNode* layerToNode(CCLayer* l) { return<br>
&gt; dynamic_cast&lt;CCNode*&gt;(l); }<br>
&gt;<br>
&gt; This way I would have only to implement toNode for every class derived<br>
&gt; from CCNode and get all the functions CCNode defines.<br>
&gt;<br>
&gt; What do you think if this Idea?<br>
&gt; How would you do it?<br>
&gt;<br>
&gt; Thanks!<br>
&gt; Nathan<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Haskell-Cafe mailing list<br>
&gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><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><br clear="all"><div><br></div>-- <br>Alp Mestanogullari
</div>