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:
1. Practical Haskell
For those experienced programmers who may be new to the Haskell programming language and some prior exposure to Haskell, you should consider picking up this resource to advance your Haskell skills. Author Alejandro Serrano Mena is working towards his PhD thesis in the Software Technology group in Utrecht University. He is passionate about functional programming, and has been coding Haskell for personal and professional projects for more than five years.
This book contains excellent coverage of the Haskell ecosystem and supporting tools, include Cabal and Stack for managing projects, HUnit and QuickCheck for software testing, the Spock framework for developing web applications, Persistent and Esqueleto for database access, and parallel and distributed programming libraries.
You’ll see how functional programming is gathering momentum, allowing you to express yourself in a more concise way, reducing boilerplate, and increasing the safety of your code. Haskell is an elegant and noise-free pure functional language with a long history, having a huge number of library contributors and an active community. This makes Haskell the best tool for both learning and applying functional programming, and Practical Haskell takes advantage of this to show off the language and what it can do.
What You Will Learn
- Get started programming with Haskell
- Examine the different parts of the language
- Gain an overview of the most important libraries and tools in the Haskell ecosystem
- Apply functional patterns in real-world scenarios
- Understand monads and monad transformers
- Proficiently use laziness and resource management
2. Programming in Haskell
Author Graham Hutton is Professor of Computer Science at the University of Nottingham. He has taught Haskell to thousands of students and received many awards for his teaching. On top of that, he wrote this resource to make sure that he can reach more people interested in learning Haskell around the globe.
Talking about this resource, it is based on the author’s experience of teaching Haskell for more than twenty years. All concepts are explained from first principles and no programming experience is required, making this book accessible to a broad spectrum of readers. While Part one focuses on basic concepts, Part two introduces the reader to more advanced topics. This new edition has been extensively updated and expanded to include recent and more advanced features of Haskell, new examples and exercises, selected solutions, and freely downloadable lecture slides and example code. The presentation is clean and simple, while also being fully compliant with the latest version of the language, including recent changes concerning applicative, monadic, foldable, and traversable types.
This is a book that absolutely anyone can read. It begins with the basics and climbs the ladder as slowly as possible so that everyone can arrive at the sweet destination in the end. Click below to get your copy home from Amazon below:
3. Haskell from the Very Beginning
In Haskell from the Very Beginning, author John Whitington takes a no-prerequisites approach to teaching the basics of a modern general-purpose programming language. Each small, self-contained chapter introduces a new topic, building until the reader can write quite substantial programs. There are plenty of questions and, crucially, worked answers and hints.
Spread over twenty two chapters, the book will appeal both to new programmers, and to experienced programmers eager to explore functional languages such as Haskell. It is suitable both for formal use within an undergraduate or graduate curriculum, and for the interested amateur.
For the beginners and those who are eager to sharpen or spruce up what they had already read about Haskell, author John Whitington will bring out the beast in you in a slow and sure pace into this wonderful functional programming language. Pick it up from the link below and read it at your own pace and all will be well.
4. Practical Haskell
Author Alejandro Serrano Mena is working towards his PhD thesis in the Software Technology group in Utrecht University. He is passionate about functional programming, and has been coding Haskell for personal and professional projects for more than five years.
Serrano ensured that this book contains excellent coverage of the Haskell ecosystem and supporting tools, including Cabal and Stack for managing projects, HUnit and QuickCheck for software testing, the Spock framework for developing web applications, Persistent and Esqueleto for database access, and parallel and distributed programming libraries.
You will see how functional programming is gathering momentum, allowing you to express yourself in a more concise way, reducing boilerplate, and increasing the safety of your code. Haskell is an elegant and noise-free pure functional language with a long history, having a huge number of library contributors and an active community. This makes Haskell the best tool for both learning and applying functional programming, and Practical Haskell takes advantage of this to show off the language and what it can do.
What You Will Learn
- Get started programming with Haskell
- Examine the different parts of the language
- Gain an overview of the most important libraries and tools in the Haskell ecosystem
- Apply functional patterns in real-world scenarios
- Understand monads and monad transformers
- Proficiently use laziness and resource management
If you are an experienced programmer who may be new to the Haskell programming language, you should bet on this resource. It will broaden your perspective, your skillset and let you shine in this new adventure. Click below to get this resource as part of your book collection.
5. Becoming Functional
Joshua F. Backfield is a Senior Software Development Engineer at Dell SecureWorks, Inc., an industry-leading MSSP. He is responsible for the design and development of many internal UI tools as well as multiple backend processes.
If you have an imperative (and probably object-oriented) programming background, this hands-on book will guide you through the alien world of functional programming. Author Joshua Backfield begins slowly by showing you how to apply the most useful implementation concepts before taking you further into functional-style concepts and practices.
Haskell is functional and having knowledge about functional programming will come a long way into making your Haskell study as smooth and as amazing as possible for you. In case you are completely green in the new functional programming paradigm, then a good introduction is as good as laughter.
In each chapter, you will learn a functional concept and then use it to refactor the fictional XXY company’s imperative-style legacy code, writing and testing the functional code yourself. As you progress through the book, you will migrate from Java 7 to Groovy and finally to Haskell as the need for better functional language support gradually increases.
While reading, you will:
- Learn why today’s finely tuned applications work better with functional code
- Transform imperative-style patterns into functional code, following basic steps
- Get up to speed with Groovy and Scala through examples