How to Install Haskell on Ubuntu 12.04 LTS

Haskell is an open-source, purely functional programming language that is based on the lambda calculus. It is the result of over twenty years of research. It has been said that even if you are not in a position to use Haskell in your programming projects, learning Haskell can make you a better programmer in any language.

You can easily install Haskell on Ubuntu using apt-get. SSH to your Pod, and run the following:

root@mypod:~# sudo apt-get install haskell-platform

Let’s compile and run a simple Hello World example using the ghc compiler. Create a file called “hello.hs” using your favorite text editor. It should contain the following:

main = putStrLn "Hello, World!"

Now, you can compile it to binary form and run it, like this:

root@mypod:~# ghc -o hello hello.hs
root@mypod:~# ./hello

Haskell also includes “ghci”, a shell where Haskell expressions can be interactively evaluated and programs can be interpreted.

To learn more about Haskell, visit haskell.org.

Matthew McCaffrey

Leave a Reply