Functional programming is a programming paradigm which involves the process of building software by composing pure functions, avoiding shared state, mutable data, and side-effects. This paradigm is declarative rather than imperative, and application state flows through pure functions. The jargon presented above are explained below:
- Pure Function: A function that if it is given the same inputs, it always returns the same output without side-effects
- Composing Functions: This is the process of combining two or more functions so as to come up with a new function or perform some computation.
- Shared state: This is any variable, object, or memory space whose scope is shared.
Features of Haskell
From Haskell’s main page, the following are the features that this programming language is proud to have:
- Statically typed: Every expression in Haskell has a type which is determined at compile time.
- Purely functional: Every function in Haskell is a function in the mathematical sense (i.e., “pure”). Even side-effecting IO operations are but a description of what to do, produced by pure code.
- Type inference: You don’t have to explicitly write out every type in a Haskell program. Types will be inferred by unifying every type bidirectionally.
- Concurrent: Haskell lends itself well to concurrent programming due to its explicit handling of effects. Its flagship compiler, GHC, comes with a high-performance parallel garbage collector and light-weight concurrency library containing a number of useful concurrency primitives and abstractions.
- Lazy: Functions don’t evaluate their arguments. This means that programs can compose together very well, with the ability to write control constructs (such as if/else) just by writing normal functions.
- Packages: Open source contribution to Haskell is very active with a wide range of packages available on the public package servers.
If you would wish to learn this purely functional programming language, the following are some resources you can take advantage of to get started: