Select Page

Learn You a Haskell for Great Good! A Beginner’s Guide

Learn You a Haskell for Great Good! A Beginner’s Guide

This tutorial is aimed at people who have experience in imperative programming languages (C, C++, Java, Python…) but haven’t programmed in a functional language before (Haskell, ML, OCaml…). Even if you don’t have any significant programming experience, anyone will be able to follow along and learn Haskell.

Haskell is great and if you’re interested in programming you should really learn it even if it seems weird at first. Learning Haskell is much like learning to program for the first time – it’s fun! It forces you to think differently.

Haskell is a purely functional programming language. In imperative languages you get things done by giving the computer a sequence of tasks and then it executes them. While executing them, it can change state. For instance, you set variable a to 5 and then do some stuff and then set it to something else. You have control flow structures for doing some action several times. In purely functional programming you don’t tell the computer what to do as such but rather you tell it what stuff is.

Haskell is also lazy. That means that unless specifically told otherwise, Haskell won’t execute functions and calculate things until it’s really forced to show you a result. That goes well with referential transparency and it allows you to think of programs as a series of transformations on data. It also allows cool things such as infinite data structures.

Haskell is statically typed. When you compile your program, the compiler knows which piece of code is a number, which is a string and so on. That means that a lot of possible errors are caught at compile time.

Haskell is elegant and concise. Because it uses a lot of high level concepts, Haskell programs are usually shorter than their imperative equivalents. And shorter programs are easier to maintain than longer ones and have less bugs.

Learn You a Haskell for Great Good! A Beginner’s Guide

by Miran Lipovaca (Online reading only) – 14 Chapters

Learn You a Haskell for Great Good! A Beginner’s Guide by Miran Lipovaca