[Haskell-cafe] Haskell mode for emacs - some questions

peterv bf3 at telenet.be
Wed Jun 20 15:29:44 EDT 2007

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, bf3 at telenet.be 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.


-----Original Message-----
From: David House [mailto:dmhouse at gmail.com] 
Sent: Wednesday, June 20, 2007 6:42 PM
To: peterv
Cc: 'David House'; haskell-cafe at 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
wouldn't work with GHCi if it works with GHC. They use the same code to

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

-David House, dmhouse at gmail.com
-------------- next part --------------
An embedded message was scrubbed...
From: "Duncan Coutts" <duncan.coutts at worc.ox.ac.uk>
Subject: Re: [Haskell-cafe] GHCI hangs on Gtk2HS SOE on Windows,
	but GHC	works fine?
Date: Sat, 16 Jun 2007 01:50:12 +0200
Size: 6254
Url: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070620/684ffc3a/attachment.eml

More information about the Haskell-Cafe mailing list