[Haskell-cafe] Re: Why Haskell?

Simon Marlow simonmarhaskell at gmail.com
Mon Jul 24 07:07:54 EDT 2006

Matthew Bromberg wrote:

> Here are some reasons why
> 1) Lack of debugging support.  Yes there are print statements and trace, 
> but I would like to set a breakpoint.  It would be nice to do so and 
> launch the GHCi interpreter with all the variable context supported.  A 
> google search revealed that there is current work on this, but 
> unfortunately the package is in cabal, which has spotty support in 
> windows it seems.
> 2) Recompiling binaries (necessary in order to link in foreign object 
> code into GHCi) is slow using GHC.  Moreover I have to restart GHCi if I 
> want to reload a changed DLL (unless there is a way to unload a DLL in 
> GHCi).  It also requires jumping around between several console windows 
> to get the job done.  (I'm not using an IDE does one exist?)

The reloading DLLs issue has come up before in the context of wxHaskell.  Please 
submit a task to GHC's tracker at http://hackage.haskell.org/trac/ghc.  This is 
something we could work on at the Hackathon, perhaps.

> 4) GHCi is really not as useful as I'd hoped.  You can not just cut and 
> paste Haskell code from a text file and run it in the interpreter.  

Here's a bit of GHCi macro hacking that lets you type in source file declarations:

Prelude> let loop = do l <- getLine; if l == "\^D" then return () else do 
appendFile "foo.hs" (l++"\n"); loop
Prelude> :def foo (\_ -> loop >> return ":load foo.hs")
Prelude> :foo
x = 42
Compiling Main             ( foo.hs, interpreted )
Ok, modules loaded: Main.
*Main> x

Type ":foo" to start entering declarations, and "^D" (followed by enter, 
unfortunatly) to stop and load the file.

This is just a quick hack, but it could be improved in lots of ways: add a 
:reset to unload the file, use :add instead of :load so you can use it in the 
context of a larger program, etc. etc.  You get the idea.


More information about the Haskell-Cafe mailing list