S J Thompson
Can anyone help? I would like to run a program using the Haskell Graphics Library under GHC on Windows. HGL is listed as a package (when ghc is asked about its packages) but not actually distributed as a package with ghc-5.02.3. On trying to remedy this, - I am able to compile HGL by hand on windows, but on executing the HelloWorld.hs the program hangs: nothing happens. - HGL doesn't appear to compile on unix (solaris). I'd be grateful for any feedback.
As far as I can see, none of the replies so far answered Simon's Win32 question, so I had quick look: - Alastair suggested using a different green card target, but no user green-carding seems needed in the win32 case -- the win32 binding comes with ghc, and the win32 graphics sources don't seem to include green card input (no .gc, .gc.in, only .hs) - using ghc --make, compilation is no (big) problem but graphics-2.0.4.src.tar.gz and SOE.msi's graphics are out of synch - running examples compiled against minimally modified graphics-2.0.4 win32 sources just blocks - running examples compiled against SOE.msi's graphics win32 sources kind of works sometimes (although that may not be obvious), but more often it produces odd effects, not at all in line with the Hugs behaviour for the same sources - the full-screen titlebar effect with the SOE variant suggests some window-handling incompatibility, if it wasn't for Hugs and GHC using the same graphics source code.. (is there a difference in the win32 bindings for Hugs vs GHC?) It seems that others started to look into this some 6 months ago, which is why the SOE version is slightly more successful, but no further progress is recorded in CVS. Has anyone succeeded in removing the remaining quirks? Claus PS. Some more details (win2k/cygwin, if that matters): The file graphics-2.0.4.src.tar.gz from the X11 section at http://haskell.org/graphics/downloading.html includes both x11 and win32 directories, but the win32-branch is out of synch (modifications to get it to compile with ghc on win32 are relatively straightforward, but then the resulting executable just hangs, so there must be some less obvious changes missing). The main Hugs98 download page at http://cvs.haskell.org/Hugs/pages/downloading.htm links to the graphics-bundle, but also provides an SOE bundle (SOE.msi), which includes a graphics bundle (also available separately). Again, the graphics bundle includes both x11 and win32 branches, but in this version, the win32 branch compiles without further changes. The resulting executables produce titlebars (full screen width) instead of windows as default, but double-clicking on the title bars unfolds a (full-screen) window, and some simple examples seem to run more or less okay (often less:-(. Here are two trivial examples: import GraphicsUtils main = runGraphics $ do w <- openWindow "testing" (200,200) drawInWindow w $ text (100,100) "1,2,3" getKey w closeWindow w The window size is ignored (full-screen titlebar effect), and after a keypress, the window closes, but the executable has to be stopped by ctrl-c. With a slight modification, main = runGraphics $ do w <- openWindow "testing" (200,200) drawInWindow w $ text (100,100) "1,2,3" drawInWindow w $ polygon [(50,50),(100,100),(50,100)] getKey w closeWindow w we get: $ a.out Uncaught Error: Polygon: Not enough storage is available to process this command. (error code: 8) Both examples run just fine with Hugs on win32, using the same win32 branch of the same graphics bundle. This may indicate differences in the win32 bindings themselves? The CVS pages (how do I find the latest location of stuff in there, btw? is there a libraries version of HGL?) at http://cvs.haskell.org/cgi-bin/cvsweb.cgi/fptools/hslibs/graphics/lib/win32/... list some changes by Sigbjorn, suggesting that Simon was not the first to run into these problems: "Misc changes to have it *compile* with ghc-5.02.1 (but not exec correctly). Based on patches contrib'ed by Frank Dellaert." PPS. Things are starting to get hard to find. Compiling a list of all locations of various graphics variants on {www,cvs}.haskell.org is left as an exercise.. :-(