From: Stefan S. A. <ste...@gm...> - 2010-06-12 20:08:29
|
Hi - After doing some work using the executable algebraic specification language called Maude (in the OBJ3/CafeOBJ family) and playing with Scala, C#, and the functional array-programming languages J (jsoftware.com) and K/KDB ( kx.com), I'm looking for an IDE to use for real-world cross-platform GUI programming (mainly database work to start with) - developing on XP and deploying to Windows, Linux, Mac and maybe eventually some of the mobile devices. Currently I'm leaning towards Haskell and wxHaskell, and I would appreciate any opinions on which IDE(s) might be good to use, as well as any pointers on how to put all the various necessary pieces together and use them. (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.) 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: http://shootout.alioth.debian.org/ Also Haskell has lots of libraries written for it: http://hackage.haskell.org/packages/archive/pkg-list.html <http://hackage.haskell.org/packages/archive/pkg-list.html>By the way, there's an interesting post comparing languages here: http://blog.srinivasan.biz/software/if-you-have-to-learn-just-one-programming-language where Haskell is one of the top choices after Scala. I do like Scala but I prefer to avoid the JVM. I've downloaded and installed the 2010.1.0.0 Haskell Platform, wxWidgets 2.8.11, MinGW 5.1.6, and MSys 1.0.11. So far I've also installed DialogBlocks 4.38 and CodeBlocks 10.05 to do some initial comparisons. For what it's worth, I've seen a list (put together by the people from CodeBlocks I think) comparing several wxWidgets IDEs: http://wiki.codeblocks.org/index.php?title=Comparison_of_wxSmith_features And I've heard that DialogBlocks was developed by one of the developers of wxWidgets. 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/ 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? 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? 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? 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? 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? Sorry if this seems really disjointed. As a a novice in the area of using Haskell for cross-platform GUI programming, I'm a bit overwhelmed now by the various choices out there for IDEs and the concrete steps involved in developing and deploying a cross-platform GUI project using wxHaskell. Any pointers would be greatly appreciated! - Scott |
From: Jeremy O'D. <jer...@gm...> - 2010-06-19 22:32:16
|
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" <ste...@gm...> 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 jer...@gm... |