A Google search pointed me at two major GUI toolkits for Haskell: gtk2hs and
wxHaskell.
I started with gtk2hs. The installation instructions were straightfoward and
easy to follow, but they just didn't work. The installer did nothing. It
opened a command window and immediately terminated. When I ran it from a
command window it terminated immediately, apparently doing nothing at all.
Running as Administrator didn't help. There was no error message, the log
file option didn't generate a log file and Googling for a solution didn't
come up with anything.
So I gave up on gtk2hs.
WxHaskell was a little trickier but more successful. There didn't appear to
be any installation instructions on the website, but it did imply that I
needed to install wxWidgets first. I did that, and made sure the paths
didn't have spaces in them (yawn). And after restarting the PC eventually I
got a working Hello World dialogue box.
Which is nice, except that when I call "main" twice in succession from GHCi,
ghc.exe crashes. So I have no confidence in the wxHaskell libraries either.
I don't want to invest time in programming with libraries that perform
illegal operations on my operating system.
I like Haskell; I really do. I've toyed around with it before a few times
and I want to learn more about it, but I can't confine myself to
command-line applications forever and for better or worse I run a Windows
box.
So, in practice, do other people write GUI apps with Haskell on Windows? And
if they do, how do they do it? I feel I've got to the stage where I need a
concrete recommendation from the experts.
My installation:
- Windows Vista Home Premium 32-bit 6.0.6001
First attempt
- GHC 6.6.1
- gtk2hs-09.12.exe
Second attempt
- GHC 6.8.2
- wxMSW 2.6.3
- wxHaskell 0.10.3
Ben
> A Google search pointed me at two major GUI toolkits for Haskell: gtk2hs and
> wxHaskell.
My answer is to use Gtk2hs. Unfortunately, the releases are somewhat
behind so you usually need to grab a special preview release to get it
working on Windows. That's a very sad state of affairs, and as is easy
to tell from this email, it gives the impression that Gtk2hs is busted
on Windows. The *only* way to fix this is to have Gtk2hs builds go
live within minutes of a GHC release going live - and I've been
pushing for that for a while (but tend to give up once my computer is
fixed...)
Hopefully Duncan will know if your problem is due to using an old
installer, or just a Vista thing - either way its a safe bet that
Duncan will fix it in due course.
> So, in practice, do other people write GUI apps with Haskell on Windows? And
> if they do, how do they do it? I feel I've got to the stage where I need a
> concrete recommendation from the experts.
Typically you need to use GHC and not GHCi - or at least you get more
success that way. If the installation instructions for wxHaskell need
improving, do tell the team behind it. wxHaskell was unmaintained for
a while, so they are still picking up speed, getting the basics
working - before tackling the polish issues.
As a reference point, I still do all my GUI programming in C# -
although am slowly taking pot shots at Haskell/Gtk2hs as new things
crop up. Although I suspect I'm likely to try F# for GUI programming
with my next project.
Thanks
Neil
_______________________________________________
Haskell-Cafe mailing list
Haskel...@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
Sunday, May 18, 2008, 10:26:09 PM, you wrote:
> I'm running Windows Vista and I've been trying to set up an
> environment for writing GUI applications.
i'm a XP user, nevertheless try this for gtk2hs:
6.6.1: http://haskell.org/ghc/dist/6.6.1/ghc-6.6.1-i386-windows.exe
http://sourceforge.net/project/showfiles.php?group_id=49207&package_id=42440
6.8.2: http://haskell.org/ghc/dist/6.8.2/ghc-6.8.2-i386-windows.exe
http://haskell.org/~duncan/gtk2hs/gtk2hs-0.9.12.1.exe
the first way is my working environment
--
Best regards,
Bulat mailto:Bulat.Z...@gmail.com
> [...] Which is nice, except that when I call "main" twice in
> succession from GHCi, ghc.exe crashes. So I have no confidence in the
> wxHaskell libraries either. I don't want to invest time in
> programming with libraries that perform illegal operations on my
> operating system.
>
I assume that you didn't use :main, but just evaluated "main"... and
that either wx or the native windoze gui doesn't like you
reinitialising it without unloading the executable that does it or
whatever: That's the problem if you call into C code, all kind of
things might go wrong.
If you don't want to invest time in programming with stuff that can
perform illegal operations, or at least be sure that you don't do
illegal operations, you are kind of stuck with Haskell, though. You
might to try out things like Fruit, which isolate you from all this
stuff.
--
(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
signature prohibited.
There seems to be a new version of Gtk2hs now (or I accidentally downloaded
an old one earlier). Either way the installer was easy to use and the Hello
World program ran (even within GHCi). Thanks for your help.
I'm very appreciative to all those who work on these projects, sorry for
sounding frustrated.
Ben
Yeah, this kind of thing is annoyingly common in Haskell circles. It's
not insurmountable though.
wxHaskell has been "dead" for a while. It recently came back to life,
but I imagine it's still a little dusty round the edges. [FWIW, I'm
really happy to see this being revived! I've never used it, but I've
heard good things about it...]
I do all my work with Gtk2hs. Yes, GTK isn't very common on Windows. But
it seems to work the nicest. There's an on-going problem though that
each release of Gtk2hs only works with one (or maybe two) releases of
GHC, and every time a new release of GHC comes out, you gotta wait a
while before Gtk2hs catches up. However, the installer usually *tells*
you that's the problem; what you're seeing sounds more like the
installer program doesn't like Vista. I can't offer any help in that
direction, unfortunately...
As for your program crashing when run twice, wxWidgets probably doesn't
like being initialised twice. I've never used wxHaskell, and I don't
know how your program is structured, but if you can avoid initialising
the library twice, you could be able to rerun the core of your program
over and over. Otherwise you're kind of stuck with the tedious
edit-compile-run cycle.
Sunday, May 18, 2008, 10:26:09 PM, you wrote:
> So, in practice, do other people write GUI apps with Haskell on
> Windows? And if they do, how do they do it? I feel I've got to the
> stage where I need a concrete recommendation from the experts.
after i've wrote a few thousands lines with gtk2hs, i think the
following:
if main part of your program is GUI - it's better to stick with C# and
all its visual bells and whistles. the only good thing with gtk2hs is
that you got Linux portability for free. actually, people will think
that you have developed it on linux and ported to windows at the last
day :D look at http://freearc.org screenshots or install program
itself to see that i mean
if you are developing large haskell program and just need to add GUI
frontend to it - you are on the right way
if you develop serious (say, commercial) application - consider
developing algorithm in Haskell and writing GUI in C# or C++ to take
best of both worlds. look for example at http://www.bcgsoft.com/ -
does this make difference compared to my program? :D
--
Best regards,
Bulat mailto:Bulat.Z...@gmail.com
_______________________________________________
There's definitely something weird going on there. I've not personally
tested on Vista but I've not heard any other reports of it not working.
Are you sure the download of the installed completed successfully? If it
exits immediately it sounds like a busted download. Do you have any way
of checking it? Perhaps just the file length if there's no easy way of
doing md5 on windows.
Since you're now using ghc 6.8.2 you'll want this build of gtk2hs which
works with that version of ghc:
http://haskell.org/~duncan/gtk2hs/gtk2hs-0.9.12.1.exe
length: 13,651,002 bytes
md5: e48ea30426396bf162106ffcda02847f
> Which is nice, except that when I call "main" twice in succession from
> GHCi, ghc.exe crashes. So I have no confidence in the wxHaskell
> libraries either. I don't want to invest time in programming with
> libraries that perform illegal operations on my operating system.
Note that Gtk2Hs does not suffer from the problem of calling main twice
in ghci.
Duncan
Useful little program for quickly finding [or checking] the MD5 hash of
any file under Windows, using simple drag and drop.
Bulat Ziganshin wrote:
> if main part of your program is GUI - it's better to stick with C# and
> all its visual bells and whistles. the only good thing with gtk2hs is
> that you got Linux portability for free. actually, people will think
> that you have developed it on linux and ported to windows at the last
> day :D
Isn't there now a Windows native look for gtk2? When will
gtk2hs support it?
In the meantime, I guess that is an advantage of wxHaskell.
> look at http://freearc.org screenshots
Bulat - very, very nice app! Why haven't I noticed that
link here before?
> if you develop serious (say, commercial) application - consider
> developing algorithm in Haskell and writing GUI in C# or C++ to take
> best of both worlds.
But then you need to rewrite the GUI part from scratch to get
it to run on other platforms.
Regards,
Yitz
Yeah, there are a couple visual improvements you could make. For one
thing you could use your own icon rather than the default Gtk+ window
icon.
Do you use glade to design the UI layout or do you do it by hand in
code? It's usually pretty easy to spot UIs that are built by hand or
using layout combinators. A good guide here is the GNOME HIG (Human
Interface Guidelines).
http://developer.gnome.org/projects/gup/hig/
Duncan
Yep.
> When will gtk2hs support it?
It has done for several years now.
> In the meantime, I guess that is an advantage of wxHaskell.
As far as I know the visual differences are pretty small. If you know of
anything specific we can file bugs with the Gtk+ folk, they've fixed
lots of little differences over the last few years.
Duncan
Monday, May 19, 2008, 1:18:10 AM, you wrote:
> As far as I know the visual differences are pretty small. If you know of
> anything specific we can file bugs with the Gtk+ folk, they've fixed
> lots of little differences over the last few years.
file open dialogs; treeview
--
Best regards,
Bulat mailto:Bulat.Z...@gmail.com
_______________________________________________
I run Vista Business 32-bit on my desktop, and I installed Gtk2Hs using
that LSystemSetup.exe installer. I don't have a link handy, I apologize.
That's a handy way to install with a few clicks for non-programmers.
Then I have my users launch my app using a .bat file that adds Gtk2Hs to
the path (this assumes they installed to the standard location, sadly)
so they don't have to go fiddling with their PATH.
The good news is that my app (which uses networking, threading, STM and
GTK) works with the same code (though obviously different binaries) on
Linux and Windows, using GHC 6.8.2.
I know that doesn't throw much light on your problem, but Gtk2Hs
certainly does work on Vista, and XP as well, and with 6.8.2 even.
Hope you find a solution,
Braden Shepherdson
shepheb
The basic problem is that wxWidgets, since around wxWidgets 2.5, uses
C++ static constructors and destructors to initialize and destroy some
internal data structures. Unfortunately, on Windows, the only way to
make these run is to unload the wxWidgets DLL when main terminates, and
this is something we do not currently do (I'm working on it, but it is
not trivial, and I have little time to work on the problem, so progress
is slower than I would like).
If this functionality is essential to you, I can only suggest using
wxHaskell 0.9.4 with wxWidgets 2.4.2. This older version of wxWidgets
does not use static constructors/destructors, and can be used to execute
main more than once. This older revision is three years old now, and
will require you to use GHC 6.4.
In terms of an 'expert' reference - wxHaskell or GtkHs are the only
reasonably maintained GUI options for Haskell. GtkHs has a larger team
of contributors, but both are capable of producing complex and stable
GUI applications - I can certainly vouch for wxHaskell in this respect
(and in respect of speed of development), and the reason I work on it is
precisely because I didn't want to see such a superb piece of software
rot through lack of attention.
However, both projects rely on fairly small volunteer teams working on
their spare time out of love (or something like it...), and I think it's
fair to say that both teams are some way from matching the ease of
developing and deploying of, say, C# or Java.
Regards
Jeremy O'Donoghue
As I said I really like Haskell it's a pleasure to program in it and I do
appreciate the work that people have put in to make it possible for me to do
so!
Hi Ben,
Sorry for the late reply, I don't check the cafe list often :)
Since it looks like I'll be doing the next gtk2hs release, let me assure
you that the installer for the next release will be tested on Vista. (I
haven't tested it yet, but I didn't realize until now we had Vista
users.) Look for it in the next couple weeks. Also, the current
development tree builds quite easily with MinGW and MSYS (see
http://www.mingw.org/) and any of the GHC binary installers as far back
as 6.4.2. If you get the Gtk+ bundle
(http://ftp.gnome.org/pub/gnome/binaries/win32/gtk+/2.12/gtk+-bundle-2.12.9.zip)
then you'll be all set. (Note that I've done all this under XP, YMMV.)
I haven't really tried it, but I understand that if you install Glade
you pretty much have a RAD environment, a-la Visual Basic or Delphi. You
can't really ask for much more than that!
Oh, a request to those of you that frequent the cafe list frequently:
Could you direct problem reports like this one to the
gtk2hs...@sf.net list, since while I am subscribed to cafe, I don't
read it on a daily basis? Thanks :)
Pete