Including registered packages for GHC using Eclipse

Howdy, This list says that rank amateurs can post here. One has arrived :-! I am just getting going with Haskell and Eclipse both, and cannot figure out how to include a package with Eclipse. I am on Win2kPro using GHC 6.2.1, wxHaskell 0.8, and Eclipse 3.0.1. Since I have just recently downloaded all of these, they should all be the latest of the stable versions. The package I am using is wxHaskell. I can go to the samples directory and type: ghc helloworld.hs -package wx -o test ...and I get a successful compilation with an executable named test.exe that runs just fine. In Eclipse, I have no problem generating executables for short Haskell programs from my tutorial (YAHT) that use the console for output, but it cannot find the wx package. I have rename the file HelloWorld.hs to main.hs in my attempts to compile. The module tries to import Graphics.UI.WX but fails. I tried going to Window->Preferences->'FunctionalProgramming-> Haskell->Compiler->GHCCompiler, and in the "ghc Executable" field, changing "ghc" to "ghc -package wx", but as soon as I start typing, the grayed out text box below says: java.io.IOException: CreateProcess: "ghc " --version error=2 java.io.IOException: CreateProcess: "ghc " --print-libdir error=2 ...and the compiler still cannot find module Graphics.UI.WX. (Not surprising, eh :-?) I believe I successfully added the directory "c:\program files\wxhaskell-0.8\bin" in Projects->Properties->ImportLibraries, but it didn't do anything. (I suppose that is for DLLs anyway, but I was trying everything I could think of before asking.) I removed it though, and now clicking on Add in that dialog doesn't seem to do anything. I thought I would ask, because although I have been told on the "FP for Eclipse" website that it is very much a work-in-progress, I figure that importing packages would have been implemented long before we got syntax coloring. Sorry this turned out so long, Thank you, -- Geoff C

I thought I would ask, because although I have been told on the "FP for Eclipse" website that it is very much a work-in-progress, I figure that importing packages would have been implemented long before we got syntax coloring. Quite the opposite ... Syntax coloring is one of the simplest things you can do in Eclipse (although it is based on simple rules and very, very crude in our case ...). Driving the compiler is a more difficult matter, especially since it has to be platform-independent with Eclipse, and the whole thing is
Hi Geoff, you have hit a weak point there ;-) You cannot yet specify packages in the Eclipse plugin. It will be possible in the next release, though, which will allow to specify additional options that are passed to the compiler. I hope to get that version (0.5) out at the end of October. Meanwhile, it is possible to hack the plugin and make it use custom options, but this requires some knowledge of Eclipse development. Instructions how to do it are here: http://sourceforge.net/forum/forum.php?thread_id=1113486&forum_id=371922 planned to support different compilers/interpreters. Ciao, Leif

Thanks, Leif! Thank you for the fast response. It took me a few times, trying different things, but I got your instructions to work. I am totally new to Eclipse. Tried importing ghcCompiler, making the change, saving, and copying jar file. No luck. Went through a few iterations, but found success after realizing I needed to be in the Plug-Ins Perspective and load all of your plug-ins (rather than just ghcCompiler). But now I am off and running. Thanks for the help, and of course, for providing this plug-in :-!!! -- Geoff
participants (2)
-
Geoff C
-
Leif Frenzel