[Haskell-cafe] EnableGUI hack changes working directory

apfelmus apfelmus at quantentunnel.de
Tue Oct 9 05:53:28 EDT 2007


Hello,

the EnableGUI hack for getting a window in GHCi on Mac OS X (10.3.9 for 
me) unexpectedly changes the working directory for the running ghci

[...] apfelmus$ ghci -i../../Hackage/SOE/src
[...] GHC Interactive, version 6.6.1, for Haskell 98.
*Main> :! pwd
/Users/apfelmus/Documents/Programmierung/Haskell/Graphics/Kunst
*Main> enableGUI >> run lambda
Loading package OpenGL-2.2.1 ... linking ... done.
Loading package GLFW-0.1 ... linking ... done.
*Main> :! pwd
/opt/local/lib/ghc-6.6.1

The effect is that reloading the Main module now fails

*Main> :r
<no location info>: can't find file: Main.hs

Any solution?


Btw, using enableGUI exactly once at the beginning of the ghci session 
doesn't work

*Main> enableGUI
<interactive>:
../../Hackage/SOE/src/EnableGUI.o: unknown symbol 
`_CPSEnableForegroundOperation'

unless ghci is started with the  -framework Carbon  option. But then, 
the working directory remains fine, so I guess the change of working 
directory bug happens while dynamically loading frameworks/shared libraries.

Is there a way to automate  ghci ... EnableGUI -framework Carbon  and 
typing  enableGUI  at the first prompt? Something like a custom shell 
script  ghci+gui  or even  ghci --with-gui ?

Regards,
apfelmus



More information about the Haskell-Cafe mailing list