Yes this was also very very confusing for me because I had the same idea
about that. I almost gave up on learning Haskell because of that (I wanted
to practice stuff from the SOE book using the latest versions), until I
suddenly found out that GHC *did* work.
Here's the explanation:
"On Fri, 2007-06-15 at 23:15 +0200, [EMAIL PROTECTED] wrote:
> I'm learning Haskell using Paul Hudak's book SOE.
>
> I'm using GHC 6.6 under Windows XP.
>
> GHC on Windows does not seem to come with HGL (is this correct?), so I
> used Gtk2HS, which contains a SOE implementation.
>
> I noticed that most programs hang when using GHCI, but they work fine
> with GHC.
It's not GHCi's fault as such. The reason it does not work well in GHCi at
the moment is a bit technical. The Gtk2Hs SOE implementation currently uses
Haskell threads. Like most GUI toolkits, Gtk+ is single threaded and
requires special attention to use it from multiple OS threads. Currently, by
default, GHC produces executables that use the single-threaded runtime
system, and this works fine with multiple Haskell threads because they get
multiplexed on the same OS thread. GHC can however produce executables that
use the multi-threaded runtime system and ghci.exe itself is such a program.
So when you use SOE with GHCi it's actually using multiple threads to access
Gtk+ an not in a safe way, so it goes wrong in a myriad of ways.
I'll take another look at trying to make the SOE stuff work with the
threaded runtime system by using the primitives Gtk2Hs provides to use
Gtk+ safely from multiple threads.
Duncan"
-----Original Message-----
From: David House [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 20, 2007 6:42 PM
To: peterv
Cc: 'David House'; haskell-cafe@haskell.org
Subject: RE: [Haskell-cafe] Haskell mode for emacs - some questions
peterv writes:
> Yes, but I can only use GHCI for error checking, because I'm using
> GTK2HS/SOE which does not work well with GHCI under Windows, it only runs
> when using GHC.
Why is this? I'm not that familiar with Gtk2Hs, but I don't understand why
it
wouldn't work with GHCi if it works with GHC. They use the same code to
compile
it.
On the other hand, you could always just set up a Makefile (which is pretty
trivial) and use M-x compile (which you should bind to a key if you use it a
lot).
--
-David House, [EMAIL PROTECTED]
--- Begin Message ---
On Fri, 2007-06-15 at 23:15 +0200, [EMAIL PROTECTED] wrote:
> I'm learning Haskell using Paul Hudak's book SOE.
>
> I'm using GHC 6.6 under Windows XP.
>
> GHC on Windows does not seem to come with HGL (is this correct?), so I
used
> Gtk2HS, which contains a SOE implementation.
>
> I noticed that most programs hang when using GHCI, but they work fine with
> GHC.
It's not GHCi's fault as such. The reason it does not work well in GHCi
at the moment is a bit technical. The Gtk2Hs SOE implementation
currently uses Haskell threads. Like most GUI toolkits, Gtk+ is single
threaded and requires special attention to use it from multiple OS
threads. Currently, by default, GHC produces executables that use the
single-threaded runtime system, and this works fine with multiple
Haskell threads because they get multiplexed on the same OS thread. GHC
can however produce executables that use the multi-threaded runtime
system and ghci.exe itself is such a program. So when you use SOE with
GHCi it's actually using multiple threads to access Gtk+ an not in a
safe way, so it goes wrong in a myriad of ways.
I'll take another look at trying to make the SOE stuff work with the
threaded runtime system by using the primitives Gtk2Hs provides to use
Gtk+ safely from multiple threads.
Duncan
--- End Message ---
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe