Thanks, Michael. For what it's worth, I actually do all of my scion-server development in EclipseFP to prove that I can proverbially "eat my own dog food".

-scooter

On Tue, Feb 1, 2011 at 2:49 AM, Michael Diamond <mdiamond@willamette.edu> wrote:
Hi guys,

After setting up three computers to use EclipseFP, I wrote the following to help others through the configuration, and thought I'd share this with you.  Feel free to use any or all of this anywhere you find it helpful.  It's somewhat Windows-centric, but should still be good enough for linux/mac users.

A couple of feature requests based on some of these steps that would make the process much simpler:
Run automatically or prompt the user to run "cabal update".  Given the iffy nature of Cabal, better error messages in the Scion build would be useful also.

Use the Preferences > General > Editors > Text Editors wherever possible.  This keeps the editor more in line with what the user is used to elsewhere.  Notably, you cannot toggle on and off line numbers simply by right clicking on where the line numbers go, this is a bug.

Attempt to automatically populate the Haskell and Cabal installations.  This ought to be easy to do since (in theory) ghci and cabal are already in the path.  Power users can always change this later.

I'm not sure how feasible this is, but it'd be really nice if the New Haskell Module dialog prompted the user to turn on or off the two automation options in the Run Configuration, so that they don't have to run it once then edit the run configuration to get what seems like core functionality.

I hope this is helpful!

Michael

Michael Diamond
dimo414@gmail.com
mdiamond@willamette.edu
www.DigitalGemstones.com


---------- Forwarded message ----------
From: Michael Diamond <mdiamond@willamette.edu>
Date: Tue, Feb 1, 2011 at 2:36 AM
Subject: Haskell in Eclipse
To: cs-465-01@willamette.edu


So I've been poking around looking for a good IDE to develop Haskell, on the assumption that there must be something more powerful than just a text editor with highlighting.  If you're happy with how you're coding Haskell, have fun and ignore this email.  But I wanted to share with you how to setup EclipseFP, since it is not trivial to set up, but gives you a pretty nice environment to work in once it is, including proper syntax highlighting (no mistaking (-->) for a comment or f' as the start of a char) automatic compilation (no need to do :r all the time) and error underlining in the file.

Having played with Leksah, which was mentioned in class and which I found to be terribly cumbersome to use, EclipseFP is hands down better for anything except (maybe) very large Haskell projects.
  1. Install GHC/GHCi - but you've done that already, right?
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. 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.
WHEW.  That's a lot of writing, but believe it or not it's pretty straightforward to setup, especially since I've already figured this stuff out for you (most of it's not documented!).  I'm happy to give you a hand setting this up if you run into any trouble.

Michael

Michael Diamond
dimo414@gmail.com
mdiamond@willamette.edu
www.DigitalGemstones.com


------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
eclipsefp-develop mailing list
eclipsefp-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/eclipsefp-develop