Created Friday 22 August 2014
Install GHC/GHCi - but you've done that already, right?
Install Eclipse 3.5+ If you haven't already got Eclipse (why not?!) download it - either the IDE for Java Developers if you're inclined to use it with Java as well, or just Eclipse Classic if not. "Installation" consists simply of extracting the eclipse folder somewhere and launching the eclipse executable, there is nothing to actually install. It prompts you to select a workspace, your user folder or your documents folder are good choices if you don't have a preference.
Install the EclipseFP plugin In Eclipse go to Help > Install New Software and paste http://eclipsefp.sf.net/updates into the Work with: field - hit enter. In the box below "Functional Programming" should show up after a few moments, cancel and retry it if it doesn't. Expand "Functional Programming" and check the 2.x.x Haskell Support plugin. Follow the rest of the steps, and EclipseFP will be installed, and will prompt you to restart Eclipse.
Update Cabal While you're waiting, launch a command prompt window (type cmd in the start bar on Win Vista/7) or terminal and enter 'cabal update'. This will update the packages Haskell needs in order to let EclipseFP work.
Configure EclipseFP Go to Window > Preferences and expand the Haskell section. Click on "Haskell Implementations" and click "Add". Enter a reasonable name (I called it "Haskell Platform") and then browse to the bin directory of your GHC installation, which on Windows is something like "C:\Program Files\Haskell Platform\2010.2.0.0\bin". It will populate the Version and Library folder items below, click Ok. Click OK to save these preferences, then open the preferences window again. Go to "Scion and Cabal" and click "Autodetect" on the right. It should add an item to the list of Installed Cabal implementations, but if it does not, click add, give it a name like "Cabal" and give it the path to the Cabal executable, which on Windows is something like "C:\Program Files\Haskell Platform\2010.2.0.0\lib\extralibs\bin\cabal.exe". Hit OK, and click Rebuild on the right to tell EclipseFP to build the "Scion server" which handles the syntax highlighting and file parsing. Optionally under Editor check "Show line numbers" and uncheck "Show print margin", I think it makes the editor pane look better. Then hit OK to exit preferences.
Build the Scion Server In theory, upon exiting the preferences window, EclipseFP will start doing a lot of work to build the Scion server. If it does not, simply exit and restart Eclipse, and when it's restarted it will start building. With any luck, this will run for a few minutes and then be done, however you may run into some trouble due to the finicky nature of Haskell's/Cabal's versioning system. If it fails, try running "cabal update" again, or running something like "cabal install network-2.3" where network-2.3 is a package the build script reported wasn't right. Once the Scion server is built, we're basically all set. Restart Eclipse one more time for good measure.
Create a Haskell Project Switch to the Haskell perspective if this hasn't happened already - top right corner, click the Open Perspective icon, click Other if you don't see Haskell in the list, and select Haskell from the popup. Now go to File > New > Haskel Project (or Project and then select Haskell Project) and create a project. To create your first Haskell file, right click on the src flolder in the project and select New > Haskell Module. This creates a Haskell file, you can do whatever you want with it. To run the file, click the Run button (green circle, white triangle) near the top. This will launch a basic GHCi terminal in the Console tab below with the prompt "Prelude>" if the file has errors, or "MODULENAME>" if it compiled successfully. You can use this like the external GHCi terminal to run commands like :t, or to make function calls of the module.
Configure How The File Runs One last thing which will make your life easier is to tell EclipseFP to automatically reload the file when it's saved, and to run a function (for instance "main") after the file is reloaded. To do this, click on the down arrow next to the run button, and select "Run Configurations". Click on the configuration on the left of the file you want, then click on the Automation tab. Check "Reload packages on save" if you don't want to have to type ":r" all day, and type a function name like "main" and check "Rerun command after reload" to run a command automatically.