Hello everybody,<br><br>I would like to start a discussion on how to generate <br>best-practice Haskell code from a model, e.g. from<br>EMF.<br><br>It seems to be very difficult and unconvenient to simulate <br>OOP with Haskell (as described in the paper &quot;Object-oriented
<br>style overloading for Haskell&quot;). However, I think it might<br>be possible to generate &quot;something useful&quot; out of a model to<br>not start from scratch an implementation.<br><br>For example, I could imagine to generate for every class
<br>a module, import and export lists and a type class (with some<br>restrictions) at the very least.<br><br>In the EMF book there is an example, PurchaseOrder, look at<br><br><a href="http://www.awprofessional.com/content/images/0131425420/samplechapter/budinskych02.pdf">
http://www.awprofessional.com/content/images/0131425420/samplechapter/budinskych02.pdf</a><br><br>at page 11.<br><br>How would you like generated code from this model to look like?<br><br>The most obvious way would be something like this:
<br><br>data PurchaseOrder = PurchaseOrder {shipTo::String, billTo:: String, items::[Item]}<br>data Item = Item {productName::String, quantity::Int, price::Float}<br><br>This does not work well if function names are reused or
<br>inheritance comes into play, however, even this might be a useful<br>starting point (better than nothing).<br><br>The benefits of the model+generate approach are well known. Best practices<br>in programming are propagated, for Haskell 
e.g. use different modules<br>for different things, use the tedious import/export lists, Haddock your code...<br><br clear="all"><br>What are your ideas?<br><br>Best regards,<br>Steffen<br><br>-- <br>Dipl.-Inform. Steffen Mazanek
<br>Institut für Softwaretechnologie<br>Fakultät Informatik<br><br>Universität der Bundeswehr München<br>85577 Neubiberg<br><br>Tel: +49 (0)89 6004-2505<br>Fax: +49 (0)89 6004-4447<br><br>E-Mail: <a href="mailto:steffen.mazanek@unibw.de">
steffen.mazanek@unibw.de</a>