Hi Stefan, I'll do my best - quite a few questions, and a few areas where I think you'll need to compromise.
On Sat, 12 Jun 2010 17:08 -0300, "Stefan Scott Alexander" <stefanscottal...@gmail.com> wrote: [snip] > (One particular additional GUI requirement I also have is a decent > datagrid control having custom cell editors - a multi-column > combo-box control or a calendar control. Plus "freezable" > left-hand column(s) would also be nice. I rejected gtk2hs because > it didn't seem to have any sort of datagrid. I see that wxWidgets > includes the class wxGrid which supports a wxGridCellChoiceEditor, > and I imagine other features could be added to wxGrid via > subclassing.) Haskell doesn't directly support subclassing - it's not an Object Oriented language in any accepted sense of the word. This means that (in effect) you typically extend/customize by aggregation rather than by inheritance. WxHaskell wraps most of wxWidgets, so you should be able to get at pretty much all of the functionality of the wxGrid, but it may be a bit ugly in places. > Regarding the choice to use Haskell: Haskell seems to be close to the > functional languages that I like. And although benchmarks are to be taken > with a grain of salt, I was pleasantly surprised to find that a > functional language like Haskell can be very fast: Optimized Haskell can be very fast indeed, but bear in mind that many of the shootout programs have had a *lot* of optimization applied. Out of the box, idiomatic Haskell is pretty fast, but it isn't C++ when it comes to performance. I should also mention that lazy evaluation can lead to cases where memory usage and/or performance are not easy to reason about. Nonetheless, I find it far faster to develop in Haskell, and the performance has always been pretty decent. > http://shootout.alioth.debian.org/ > > Also Haskell has lots of libraries written for it: The library situation is not quite so good on Windows as it is on Linux. Haskell itself is very portable, and 'pure' Haskell libraries almost never cause issues, but libraries which wrap external libraries (e.g. XML parser written in C) can be very difficult to get going on Windows in practice. > Regarding Haskell Platform 2010.1.0.0 and wxHaskell on Windows, this post > indicates that some additional steps may be involved: > > http://wewantarock.wordpress.com/tag/wxhaskell/ That's correct (I wrote the post!). The current version of Haskell Platform was mistakenly released with only a C compiler (Haskell Platform includes a cut-down MinGW). This will be fixed in the next release. The blog post basically explains one way of putting the missing C++ support back into the platform. > As a beginner with Haskell and wxHaskell, I'm a bit confused right now > about all the various pieces I might need to get started and how to > actually use them. I have the following questions: > > 1 - Which IDE(s) would people recommend for doing cross-platform GUI > programming using Haskell & wxHaskell? There aren't too many choices. I have only used two, although people have been saying good things about Leksah, which is a Haskell GUI written in Haskell (using Gtk2HS). Personally I use emacs about 99% of the time. Whether you consider this to be an IDE is probably open (most wouldn't), but it probably has the best and most mature Haskell support around. You will want haskell-mode, and may be interested in adding scion (which gives flymake support, and some nice IDE-like functionality. I've also used EclipseFP, which is an Eclipse-based Haskell environment. This is a bit friendlier than emacs, but feels like a work in progress in places, and has a few rough edges. It's very promising, however. > 2 - Where might I find information on how to put all the various pieces > together? For example when creating a project in CodeBlocks, it asks me > if > I'll be using wxSmith or wxFormBuilder (or no GUI builder). So I guess I > might also need to install one of these in order to best use CodeBlocks? You need to generate a plain XRC file (this is the XML representation of wxWidgets serialization). I'll explain a bit more further down... > 3 - What is the process for using an IDE to do cross-platform GUI > programming using Haskell & wxHaskell? I assume I would start by > designing > an interface using the IDE and write some code in Haskell. Would this > give > me an interface defined in terms of just wxWidgets? Would I have to do > something additional to get the interface to be defined in terms of > wxHaskell? Create your GUI with your preferred GUI designer. I used wxFormBuilder when I was developing the XRC support, but I think most of the others should be able to work. You just need to tell them to generate an XRC file. > 5 - I hear that some of the IDEs emit something called XRC files, and > according to this link (http://haskell.org/haskellwiki/WxHaskell) > wxHaskell now supports these files. Do I have to create XRC files? If > so, what do I do with them? Most of the GUI designers work in much the same way. You design your GUI and then the designer generates some code. You generally have two or three options in most of them. One approach is to generate C++ (or, occasionally, wxPython) code which will display your GUI. This code typically contains comments along the lines of 'put your code here' in places. It tends to have the advantage of generating smaller and faster code, and works better if you are using subclassing in your design (XRC has basic subclassing support, but I don't think it works very well). The other approach is to generate an XML representation of the control tree. This is what an XRC file is (you can create one by hand if you want to). Recent versions of wxHaskell can load XRC files which contain standard wxWidgets controls. What happens is that you load the XRC file into the main frame of the application, which deserializes the XRC file and instantiates objects corresponding to the UI described by the XRC. In wxHaskell, when you create a widget, e.g. by: b <- button parent [] The widget handle, b, is just a Haskell wrapper around a C++ pointer to a wxButton object. As such, you can fetch a handle to anything created by the XRC file abd then use it just like any object ceated in wxHaskell. There *is* a downside, and that is that the XRC widget creation functions are not typseafe. If you fetch a control into the wrong type, you will likely get a hard crash. > 4 - The IDEs are often geared towards development using C++. I assume I > can > safely ignore the options about C++, but how do I find the options for > building and compiling my code using Haskell and wxHaskell using one of > these IDEs? I see menus in DialogBlocks and CodeBlocks asking me to pick > a > C++ compiler. Do I need a C++ compiler in order to use a wxWidgets IDE > with > Haskell? Do I need to customize the IDE so that it can access a Haskell > compiler instead of a C++ compiler? You may be able to do this with some IDEs, but it isn't always easy. EclipseFP at least has the hard work done for you. You do need a C++ compiler, as it's required to build wxHaskell itself, but it needs to be the one in the Haskell Platform (if you're on Windows, anyway). However, the wxWidgets IDE simply needs to generate an XRC file for you. I should add, finally, that wxHaskell does have its own declarative approach to GUI, Layout, which is in some respects safer to use. It's certainly more mature and typesafe, but a little trickier to get quite the behaviour you expect with. Good luck. I'll be happy to try to answer more specific questions. Regards Jeremy -- Jeremy O'Donoghue jeremy.odonog...@gmail.com ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ wxhaskell-users mailing list wxhaskell-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxhaskell-users