<div dir="ltr">Hi Ertugrul,<br><div class="gmail_quote"><div dir="ltr"><div><br></div><div>Thank you for the detailed reply.  From what you wrote, partial FFI still seems like the way to go.</div><div><br></div><div>Unfortunately Ogre isn&#39;t the only large library I&#39;m using, so &quot;difficult&quot; several times over sounds like a good way to handicap the project early on.</div>
<div><br></div><div>I&#39;m perfectly happy to use Haskell for the strengths that will most benefit my project.  I can always go back and try to bring the C++ specific parts into the fold once a prototype is up and running.</div>
<div><br></div><div>As it seems there is a great deal of c/c++ to do either way, I would really appreciate so thoughts towards my original question.</div><div><br></div><div>What practices in C++ are preferred by Haskell users, in the know, for the parts of the app that will not be pure Haskell?</div>
<div><br></div><div>Should I be looking to avoid OOP?  Dependency Injection? I wont reiterate all the facets of the first post, but it would help me immensely to zero in on a few patterns and strategies that can minimized the damage I inflict in c++ land.</div>
<div><br></div><div>Thanks,</div><div>Casey</div><div><br></div><div>p.s.</div><div><br></div><div>With</div><div><br></div><div>&quot;That used to be true, but the reason has nothing to do with the language.  The problem was that the libraries weren&#39;t there.&quot;</div>
<div><br></div><div>What do you mean? Which packages should I be looking at?  I am on iOS like I said, its a stage 1 GHC compiler so I don&#39;t have access to GHCI or template haskell.</div><div><br></div><div><br></div>
<div>&gt;Casey Basichis &lt;caseybasichis at <a href="http://gmail.com/" target="_blank">gmail.com</a>&gt; wrote:</div><div>&gt;</div><div>&gt;&gt; I&#39;m not entirely sure what you mean.</div><div>&gt;&gt;</div><div>&gt;&gt; I&#39;m intending on using Ogre for GUI - for which there is the Hogre</div>
<div>&gt;&gt; bindings, but after emailing the DEV about it, I didn&#39;t get the</div><div>&gt;&gt; impression from his advice that I should be using it for production</div><div>&gt;&gt; code.  Here is what he suggested:</div>
<div>&gt;&gt;</div><div>&gt;&gt; &quot;It depends, really. Hogre is good for running Ogre from within</div><div>&gt;&gt; Haskell, but it has its limitations. The number one thing people have</div><div>&gt;&gt; been struggling with is handling input with hogre - there&#39;s Hois</div>
<div>&gt;&gt; (Haskell wrapper for OIS) but it&#39;s not perfect (it misses input</div><div>&gt;&gt; events), and the other option is having to write some C++ glue. Hogre</div><div>&gt;&gt; is a solid proof of concept and you can do some demos with it, but if</div>
<div>&gt;&gt; you&#39;re e.g. writing a game it might be a bit of a struggle. In the end</div><div>&gt;&gt; it&#39;s about how much you value being able to write code in Haskell (or</div><div>&gt;&gt; how allergic to C++ you are).&quot;</div>
<div>&gt;&gt;</div><div>&gt;&gt; I&#39;m on iOS so I imagine those difficulties are compounded.</div><div>&gt;&gt;</div><div>&gt;&gt; I am using several other C++ libraries for which there are no existing</div><div>&gt;&gt; bindings and no Haskell alternative packages that are even remotely</div>
<div>&gt;&gt; close.</div><div>&gt;&gt;</div><div>&gt;&gt; Are you suggesting it would be better to write all my own FFI bindings</div><div>&gt;&gt; for all the needed libraries?</div><div>&gt;</div><div>&gt;That&#39;s not what I&#39;m suggesting.  It was just too little information to</div>
<div>&gt;properly judge the difficulty of doing everything in Haskell.</div><div>&gt;</div><div>&gt;Binding to Ogre (or C++ in general) is indeed difficult.  If Hogre</div><div>&gt;doesn&#39;t work or is too limited, your best option might be to write a C</div>
<div>&gt;wrapper around the Hogre functionality you need.  Another option is to</div><div>&gt;use SDL/OpenGL directly, which may be easier or harder depending on your</div><div>&gt;application.</div><div>&gt;</div><div>&gt;However, if you can build the bridge between your rendering library and</div>
<div>&gt;Haskell, then Haskell is certainly the better choice.</div><div>&gt;</div><div>&gt;</div><div>&gt;&gt; Everything I read suggests that Haskells strengths are in</div><div>&gt;&gt; transformation and that interaction is not its strong suit.</div>
<div>&gt;&gt;</div><div>&gt;&gt; I am interested in your thoughts and I am open to whatever, but you</div><div>&gt;&gt; are the first to suggest that the mix is a bad idea.</div><div>&gt;</div><div>&gt;That used to be true, but the reason has nothing to do with the</div>
<div>&gt;language.  The problem was that the libraries weren&#39;t there.  Nowadays</div><div>&gt;you can write all sorts of interactive applications in Haskell,</div><div>&gt;including GUIs, TUIs, games, simulations and web applications.  However,</div>
<div>&gt;I&#39;ve long been waiting for useful bindings to Ogre or Irrlicht, but I&#39;m</div><div>&gt;afraid that it&#39;s not going to happen any time soon.</div><div>&gt;</div><div>&gt;Ultimately it&#39;s your choice.  Let me summarize the possiblities:</div>
<div>&gt;</div><div>&gt;  * C wrapper around Ogre.  Easy integration, but need to write the</div><div>&gt;    rendering code in C/C++.</div><div>&gt;</div><div>&gt;  * Full FFI bindings to Ogre.  Difficult integration, but you can write</div>
<div>&gt;    your rendering code in Haskell.</div><div>&gt;</div><div>&gt;  * Partial FFI bindings to Ogre.  Integration may be somewhat easy, if</div><div>&gt;    you do the initialization in Haskell and the actual rendering in</div>
<div>&gt;    C/C++.  However, this again requires to write the rendering in</div><div>&gt;    C/C++.</div><div>&gt;</div><div>&gt;  * Using SDL/OpenGL directly:  Everything available for Haskell.  May</div><div>&gt;    be difficult, because you need to write OpenGL code.</div>
<div>&gt;</div><div>&gt;I hope, this helps.</div><div>&gt;</div><div>&gt;</div><div>&gt;Greets,</div><div>&gt;Ertugrul</div></div></div><br><br clear="all"><div><br></div>-- <br>Casey James Basichis<br>Composer - Cartoon Network<br>
<a href="http://www.caseyjamesbasichis.com/" target="_blank">http://www.caseyjamesbasichis.com</a><br><a href="mailto:caseybasichis@gmail.com" target="_blank">caseybasichis@gmail.com</a><br>310.387.7540<br></div>