Saturday, January 17, 2015

Functional programming - Haskell

Last two week I have been working with Haskell and it is really a great experience. So far I have experience with the imperative programming. I have a chance to work with functional programming with Haskell in my masters program at M.U.M University Iowa, USA . I wanted to share some of my experience.

I have followed most my learning through the book 'Real World Haskell' here is the link :
http://book.realworldhaskell.org/read/


You might follow the above book which is really very helpful to learn Haskell.

I have used Windows environment for this programming.

What you need to do to start?
Download the Haskell platform here: https://www.haskell.org/platform/windows.html

Now we can write some program:

Open  GHCi from program files:
















This will open Prelude and you can use it just like a calculator:












Is there any easy learning editor?
I have used the Heat editor which is very easy to use and learn

Download here: http://www.cs.kent.ac.uk/projects/heat/

Lets try a factorial problem:

fact n = if n < 2 then 1 else n * fact(n-1)

Really cool it is single line function





















Haskell is a real functional programming language. It has really amazing capability you can try that. I am ending my post here :)



 

1 comment: