Haskell – Functional programming

As you may have noticed I study computer science and therefore I would like to write some things regarding the studies on my blog. Of course the focus is mainly music and environmental but technology is also a big part of our life so… Here it comes.

Haskell is a programming language that is functional and my experience of programming is, before entering the program, mainly Java, an imperative language. And also a lot of webbprogramming as a hobby but it is not real programming in this sense.

Functional programming can shortly be described as programming with no side-effects.

But even side effects are possible since you for example will sometime need input and output, so called I/O. This type of programming in Haskell is called inpure.

This picture I found on Internet makes me a little bit sceptical about I /O monad:

(pic from Haskell guide)

What sites you should check out when programming with Haskell :

  • Hoogle. Oh yes, stop googling and start hoogling !
  • Learn you a Haskell. An online book about Haskell. Learn you a Haskell for great good. Well, well. I’m just doing it to pass the course ūüôā The examples in the book are ethically miserable but you can learn a lot from here.
  • Haskell Wiki. The how to guides of Haskell.
  • A Haskell guide here.

Have you used another site that should be on the list? Let me know and I will update!

The fun of Haskell

What I find intriguing about Haskell, as my first functional programming language is how compact the expressions can be. Following syntactic structures are very cool:

Pattern matchning

A simple and very clarifying example is lucky seven:

lucky :: (Integral a) => a -> String

The example is from LearnyouaHaskell.


bmiTell :: (RealFloat a) => a -> String  bmiTell bmi     
|¬†otherwise¬†¬†¬†=¬†“Check your input again.”

The example is from LearnyouaHaskell and the program feedback is modified because the original is hideous (unethical), supposedly fun but I think they should rethink it. Whatever, check the cool guards!


The input/output (I/O) of Haskell is called inpure programming, since it is programming with side effects.

The classic “Hello world!” in Haskell:


Learn you a good Haskell has a chapter with Input and Output.

Is Haskell my new passion in life?

No, actually but I am happy to have experienced it. I still would say I totally prefer imperative programming like Java, it makes more sense to me.


Publicerar detta inlägg bara på engelska eftersom alla sidor som ovan nämns är på engelska och även vår undervisning.


2 thoughts on “Haskell – Functional programming

  1. Well, you’ll get all the Java you’ve ever wanted during IOOPM, and probably at least nine times as much C as any mortal can tolerate. ūüôā

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s