Learn Haskell
Posted on 2015-08-14 02:11:25 +0900 in Functional Programming
Why Functional Programming
In the current world, tons of programming languages exist now, and tons of new ones are being created.
Imperative Programming
I am more confident in C
, Python
, only familliar with C++
and Java
in some sense.
-
C
is consise and small, but lacks a lot of libraries in its standard. It is used to implement critical componenet such as Kernel, PostgreSQL, Redis, etc. It worths when the system efficiency overweights the developing speed. -
C++
is powerful but much too complex. The compiler does a lot of things behind the scene. It really costs to learn the specific conditions in the compiler, such as function overloading, Numeric promotions, Rule of three, etc. -
Java
is much simpler thanC++
, which is highly portable on JVM and truly object oriented. It consists of tons of frameworks and libraries, but is really verbose. It is used to build large softwares and is still popuar in big companies which provide web services. -
Python
is really simple glue language. Due to its simplicity, people around the world not only the professional programmers are contributing all kinds of libraries. As it is dynamic typing, it is hard to build large system.
In my view, the key of Imperative Programming lies in controlling side effects which make the programme hard to reason about and buggy.
How Functional Programming shines
In Python
, function
is the first class, and it supports some basic FP features such as map
, reduce
, list comprehention
, etc.
I find it really cool to have the following features,
- Suitable for wholemeal programming
- Easy to reason about as it has no side effects
- Easy to parallelize
Why Haskell
- Completely referentially transparent
- Powerful type system
- Industrial use
- Concise
How to learn Haskell
As exercise plays an important role in learning, I would like to follow the suggestions in learn haskell, first finish CIS194, then try NICITA.
Here is the source code for CIS194.