About the Book
It is a fundamental book about Software Design in Haskell. The main idea of this book is to provide a comprehensive source of knowledge, a complete methodology of building real world applications in Haskell. Application architectures, best practices, design patterns and approaches, - all the information you need to achieve a simple, maintainable, testable code with low complexity and low risks. By reading this book, you’ll learn many useful techniques: from the requirement analysis to the implementation of particular subsystems such as SQL and NoSQL databases, multithreading, logging. You’ll learn about design principles, application layers, functional interfaces, Inversion of Control and Dependency Injection in Haskell.
The book has 9 chapters, 780K symbols, 120K words.
There is a printed version of the book. This is how it looks like (video) . You can either obtain a light package with the e-book only, or buy a full package offering an e-book copy, educational videos and a paper book. Send me your PurchaseID and shipping address by email , and I'll send you a copy for free.
Paper book is unavailable for now. I'm experiencing big troubles with international shipping. You can find the detailed explanation here. I'll contact to all my buyers who didn't receive their paper copies due to that.
The book is very practical. It will be useful for software engineers who want to improve their software design skills with a strong relation to many advanced Haskell concepts.
The book requires a certain level of Haskell knowledge, up to intermediate.
The book covers a big gap in the Haskell ecosystem: the lack of resources about high-level application design. It’s also important that the ideas from the book were used in real production with great success. The book offers my own methodology - Functional Declarative Design, with Hierarchical Free Monads as a core technology. Using this methodology, I created several real-world frameworks, and they are driving a successful business in several companies.
- requirements analysis and architecture modeling;
- application layering;
- design principles, SOLID;
- Haskell-specific design patterns;
- Inversion of Control and Dependency Injection;
- domain modeling, embedded and external DSLs;
- functional interfaces, subsystems and services;
- Free monads, ReaderT pattern, Service handle pattern;
- Final Tagless/mtl, GADTs
- multithreading and concurrency;
- state and stateful applications;
- design of business logic;
- interaction with impure subsystems;
- relational and key-value databases;
- error handling, exceptions, error domains;
- web servers, HTTP backends, CLI applications;
- property-based, functional and integration testing;
- black box and white box testing.
The book is project-based. There are two showcase projects for it:
- Hydra, a full-fledged framework for building web services, multithreaded and concurrent applications with SQL and KV DB support. Contains 3 engines: Final Tagless, Free Monad and Church Encoded Free Monad, as well as several demo applications to compare these 3 approaches.
- Andromeda, a SCADA software for spaceship control.
I designed the following real-world frameworks using the ideas from the book (with the help of other people of course):
- EulerHS - a Haskell framework for web backends and console apps. Has many subsystems out of the box: SQL DBs support (Postgres, MySQL, SQLite), KV DBs support (Reddis), logging, concurrent flows, exception handling, automatic whitebox testing, typed options and other stuff.
- PureScript Presto - a PureScript framework for building mobile apps using a handy eDSL.
- PureScript Presto.Backend - a PureScript framework for web backends. It has the same design as Presto but also is empowered by some additional features like logging, HTTP APIs integration, KV DB, SQL DB subsystems, state handling, automatic whitebox testing, and other useful stuff.
All of these frameworks drive the business of an Indian financial company Juspay. Its mobile apps and financial backends have hundreds of thousands lines of code, and these frameworks are really tested in production. This technology helped the company to grow up and enabled a wide adoption of PureScript and Haskell. Essentially, Juspay was the first company I used my ideas in. We found that Hierarchical Free Monads hide all the complexity of implementation details behind convenient interfaces so that the code is understandable by not only developers but by managers as well. This helped us to easily reason about the domain, the logic, the business goals and requirements. My approach also brought confidence that Haskell and PureScript are not only academic languages.
- Node - a full-fledged framework for building distributed, concurrent, multithreading apps, blockchains initially, but not only. I designed this framework for Enecuum and then we successfully created our own blockchain using it. What's important, we managed to achieve our goals less than in 4 months with a team of 4 haskellers. The framework allowed us to write fast, complicated blockchain logic easily, quickly, without bugs and with maximum confidence due to a great testability of the HFM approach. You can read more about the framework in this my article: Building network actors with Node Framework.
About the Author
International speaker, researcher, author
Expert Haskell and C++ developer
Software architect, team lead
Author of the book "Functional Design and Architecture"