[Haskell-cafe] EnableGUI hack changes working directory

2007-10-09 Thread apfelmus

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

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] EnableGUI hack changes working directory

2007-10-09 Thread Yitzchak Gale
apfelmus wrote:
 Is there a way to automate  ghci ... EnableGUI -framework Carbon  and
 typing  enableGUI  at the first prompt?

I have the following in my .ghci file:

-- Read GHCI commands from the file whose name is
-- in the GHCIRC environment variable
:def _load 
const(System.Environment.getEnvironment=maybe(return)readFile.lookupGHCIRC)
:_load
:undef _load

That allows me to easily define shell commands that
open all kinds of specialized GHCi environments.

Hope this helps,
Yitz
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe