Solving Real-World Problems with Strongly Typed Functional Programming
Rebecca Skinner

#Haskell
#Mac
#Linux
#Windows
Put the power of Haskell to work in your programs, learning from an engineer who uses Haskell daily to get practical work done efficiently. Leverage powerful features like Monad Transformers and Type Families to build useful applications. Realize the benefits of a pure functional language, like protecting your code from side effects. Manage concurrent processes fearlessly. Apply functional techniques to working with databases and building RESTful services. Don't get bogged down in theory, but learn to employ advanced programming concepts to solve real-world problems. Don't just learn the syntax, but dive deeply into Haskell as you build efficient, well-tested programs.
Haskell is a pure functional programming language with a rich ecosystem of tools and libraries. Designed to push the boundaries of programming, it offers unparalleled power for building reliable and maintainable systems. But to unleash that power, you need a guide. Effective Haskell is that guide. Written by an engineer who understands how to apply Haskell to the real world and uses it daily to get practical work done, it is your ticket to Haskell mastery.
Gain deep understanding of how Haskell deals with IO and the outside world by writing a complete Haskell application that does several different kinds of IO. Reinforce your learnings with practice exercises in every chapter.
Write stable and performant code using Haskell's type system, code that is easier to grow and refactor. Leverage the power of pure functional programming to improve collaboration, make concurrency safe and easy, and make large code bases manageable.
Implement type-safe web services, write generative tests, design strongly typed embedded domain-specific languages, and build applications that exploit parallelism and concurrency without fear of deadlocks and race conditions. Create and deploy cloud-native Haskell applications. Master the performance characteristics of functional applications to make them run faster and use less memory.
Write Haskell programs that solve real-world business problems.
What You Need:
Table of Contents
1. Getting Started with Haskell
2. Working with Lists
3. Getting Started with Types
4. Creating New Types
5. Creating and Structuring Haskell Projects
6. Type Classes
7. Understanding IO
8. Working with the Local System
9. Introducing Monads
10. Mutable Data in the Real World
11. Serializing Heterogenous Data
12. Deserializing Heterogenous Data
13. Building Applications with Many Effects
14. Building Efficient Programs
15. Programming with Types
Why This Book
Haskell can offer enormous benefits to individuals and developers who want to write high quality software, but as the saying goes “if it were easy, everyone would do it.” The benefits of Haskell come at the cost of a steep learning curve. Haskell is hard to learn, but this book will help. Learning Haskell can be hard in part because it’s so different from other languages you’ve probably used. This ends up being a particularly hard problem because many of the most unusual concepts that you need to learn often show up all at the same time, leading to circular dependencies in your learning plan. This book has been carefully designed, especially in the first half, to provide an on-ramp to the language that avoids the need to get into circular knowledge references.
Rather than teach you how to translate your programs from other languages, in this book you’ll develop an intuition for how to think about programs in Haskell from the ground up. This will make it easier for you to read other developers’ code, make you more effective at writing code, and help you with troubleshooting.
Most of the chapters in this book build on concepts from previous chapters, and no content in any chapter relies on concepts that have not yet been introduced. You’ll never be forced to use something that hasn’t yet been fully explained. In the last half of this book, once you have worked through the fundamental materials, you may be able to approach some material out of order if there are particular areas that you are interested in.
Some features of Haskell can seem unnecessarily complex the first time you encounter them. Some people, when they are faced with a feature that makes no sense will assume that the feature was a bad idea and give up on learning it altogether. Other people will put the concept on a pedestal and assign it disproportionate significance. In either case, the lack of motivation for the things Haskell does differently can be a barrier to learning. To help with that, each time a new concept is introduced in this book, we’ll dedicate a significant amount of time to establishing a motivation for that concept to help you better internalize the reason for the design decisions Haskell makes. Understanding the motivation will ensure that you’re better positioned to make informed choices about how to design your applications, and when and how to use features of the language.
Since you’ll be learning to think about programming in an entirely new way, we’ll approach the material quite slowly in the beginning, carefully outlining all of the intermediate steps that go into executing some code, and walking through multiple examples. As you approach the middle of the book the pace will pick up, and by the last few chapters you should be learning new concepts at the pace of a native Haskell developer.
How to Read This Book
This book has been designed to be read cover-to-cover as a tutorial and workbook, or to be used in a classroom or reading group setting. Starting with Chapter 1, each new chapter will continue a theme or build on some knowledge that you picked up in the previous chapter. If you have some prior experience with Haskell it’s worthwhile to start reading from the beginning so that you can follow along with the subsequent references to earlier material.
For more experienced Haskell developers, this book can also serve as a useful resource to help you learn some practical ways to apply more advanced techniques. If you’ve used Haskell in school or written a few small programs and are looking to move into building larger production applications, you may find it helpful to skim the first half of this book and then start reading the second half more thoroughly.
As you are working through the book, you’ll encounter several different kinds of example code. You should always be able to tell what type of environment you should be working in based on the formatting of the examples:
Until you have finished Chapter 5, create a new directory for each chapter. Inside of the directory you create for each chapter, create a file named after the current chapter, for example, Chapter1.hs. You can use this for keeping track of example code and experiments you want to run. You’ll also create several files named Main.hs as you are working through the examples. You can put each of these in a subdirectory, for example, one subdirectory per chapter, or you can rename your old Main.hs files when you are no longer actively working through them. Whatever organizational scheme you prefer, ensure you keep around all your examples and experiments since you’ll want to refer to them frequently as you are learning.
Once you’ve worked through the chapter on Cabal, you’ll be better equipped to create fully stand-alone projects that you can build. You’ll also learn how to re-use code that you’ve written. From that point onward, you can create a new project for each chapter or each major example.
Rebecca Skinner is a software engineer with over 10 years of experience in Haskell and functional programming across industries including security, cloud infrastructure, and data science. She currently volunteers as a member of the Haskell.org committee.









