Now that I am more comfortable with F#, I feel that it is about time I started learning Haskell. Well another reason is that I got sick and tired of hearing some of these Microsoft people like Erik Meijer, Brian Beckman and Joe Duffy talk about Haskell :-)
Given that F# was born out of Haskell concepts to fit on the .NET platform, I figure it would be good to have the parent language under my belt. In addition, given that Haskell has support for concurrency and parallel programming, and the software and hardware world is shifting in that direction, then it is only natural to evolve along these patterns as well. Actually, I am more curious about Haskell and what it has to offer and I figure that learning it will make me a better and more conscientious developer. From some of the interviews coming out of Microsoft, it is clear that the Parallel and Concurrent working groups are also borrowing ideas from Haskell. I am glad I got into F# first, as it is making Haskell much easier to understand.
Even though Haskell has been around for a while, in terms of tools and IDE support, that area is still lacking. While everyone has their preference, I would like to use my first post to you how to use Haskell in the Eclipse IDE.
- Download and install the latest version of Eclipse. If you are already using Eclipse for Java Development, then either skip this step or get the latest version. As of this writing, I am using Eclipse Version 3.4.1 Ganymede.
Note: There really isn't any 'install' step for Eclipse. All you have to do is extract the compressed file to a location on your computer and run eclipse.exe.
- Download and install the Haskell. As of this writing, I am using Version 6.10.1 (released on 2008/11/04) on the Windows Server 2008 SP1 Operating System.
- After installing Haskell, you can begin using the command line interpreter, GHCi to muck around. For Windows folks, go to Start -> Run and type in ghci. Fig 1 shows the result.
- The next step is to get the Haskell Plugin for Eclipse. First, fire up Eclipse and you may need to set up a Working Environment if this is the first time you are running Eclipse. The Working Environment is basically setting up a folder to put your projects and files in.
In Eclipse, go to :
Help -> Software Updates
- Click the Available Software tab. Select the Add Site... button on the right of the new window that opens up and enter the URL:
http://eclipsefp.sf.net/updates. Click Ok.
- You are now ready to install the plugin. The Available Software tab may look something as shown in Fig 4. Simply check expand the node of the site you entered previously and select the component to install as shown in the figure. Once it is done installing, restart Eclipse.
- Once you restart Eclipse, the first thing you will want to do is configure the plugin to point to the ghc.exe you installed previously. Go to
Window -> Preferences and notice in the Preferences window, there is a nested view for Functional Programming. Go to the Compiler option as shown and navigate to where you installed Haskell. Find and select ghc.exe as shown in Fig 5. It can be seen that I installed Haskell on my C Drive, just navigate to where you put it and select the correct file.
- The next step is to switch to the Haskell Perspective. Eclipse's default is set to the Java Perspective. To change perspectives, go to
Window -> Open Perspective -> Haskell as seen in Fig 6. Also you can do this by clicking the Haskell button in the top right corner of the Eclipse Window.
This concludes how to get Haskell and Eclipse to play nice with each other. My next post will show to to use the plugin for development as this post is already too long.