What is functional programming?
In a nutshell:
- Functional programming is a method of program construction that emphasises functions and their application rather than commands and their execution.
- Functional programming uses simple mathematical notation that allows problems to be described clearly and concisely.
- Functional programming has a simple mathematical basis that supports equational reasoning about the properties of programs.
Our aim in this book is to illustrate these three key points, using a specific functional language called Haskell.
1.1 Functions and types
We will use the Haskell notation
f :: X -> Y
to assert that f is a function taking arguments of type X and returning results of type Y. For example,