FDaA: EH is an advanced book about building real programs with an engineering approach in statically typed functional languages.
Buy here: Functional Design and Architecture: Example in Haskell

It is a fundamental book about Software Design in Haskell and other functional languages such as Scala, OCaml, and F#. The book is a comprehensive source of knowledge and a complete methodology: Functional Declarative Design for building real-world applications with functional ideas.
The book requires a certain skill in Haskell or a similar language, up to intermediate.
The book is very practical. Application architectures (especially my own approach, which I called Hierarchical Free Monads), best practices, design patterns, and approaches — all the information you need to achieve a simple, maintainable, testable code with low complexity and risks. By reading this book, you’ll learn many useful techniques, from requirement analysis to implementing particular subsystems such as SQL and NoSQL databases, multithreading, and logging. You’ll learn about design principles, application layers, functional interfaces, Inversion of Control, and Dependency Injection. It’s not just theoretical knowledge; the ideas from the book were used in real production with great success.
The book will be useful for software engineers who want to improve their software design skills and learn state-of-the-art functional approaches.
Topics
- Functional architectures
- Functional design patterns and functional idioms
- Accidental and essential complexity of FP programs
- Design principles (SOLID, Low coupling / High cohesion; KISS etc.)
- Architecture modeling, requirements analysis, subsystems design from FP point of view
- Embedded and external DSLs in domain modeling (as a part of Domain-Driven Design)
- Monads as subsystems with effects
- Free monads as functional interfaces
- Other types of functional interfaces
- Inversion of Control in FP (using Free monadic eDSLs)
- Applicability of mainstream techniques and approaches such as UML
- Interaction with impure subsystems
- Command-line applications and backend applications
- Type-level programming
- Various testing approaches, including property-based, functional, unit, integration, etc.
- Approaches to building functional real-world concurrent application frameworks
Related projects and materials
There are several real-world projects based on the ideas from the book:
- Juspay’s EulerHS framework (Haskell). A full-fledged framework for building web backends in Haskell. Provides own philosophy of layering, testing, and application architecture. The older brother of Hydra. Supports SQL DBs (MySQL, Postgres, SQLite), KVDBs (Redis), logging, multithreading, automatic regression testing, and more.
- Juspay’s Presto framework (PureScript). Framework for building mobile apps using a handy eDSL.
- Juspay’s Presto.Backend framework (PureScript). Framework for web backends.
The book is project-based. Actually, 2-projects-based.
- Andromeda platform. A SCADA-like application and simulator for starship control. The first 8 chapters of the book describe the architecture and design of this project.
- Hydra framework. A full-fledged Free Monadic framework to build web services and console applications in Haskell. Supports various SQL DBs, KV DBs, logging, state, multithreading, etc. It also provides several demo applications and testing facilities. Hydra has 3 different engines based on Final Tagless, Hierarchical Free Monads, and Hierarchical Church Free Monads to provide a common basis for comparison of these approaches.
Related articles:
- Hierarchical Free Monads: The Most Developed Approach In Haskell (article)
- Automatic White-Box Testing with Free Monads (article, showcase)
- Building network actors with Node Framework
- List of materials on Software Design in Haskell
I’m also giving talks on this topic.
- Hierarchical Free Monads and Software Design in Functional Programming (talk, English)
- Automatic Whitebox Testing with Free Monads (talk, English)
- Final Tagless vs Free Monads (talk, Russian) | slides (English)
Functional Design and Architecture (early edition)
There is an early edition of the book, initially self-published with LeanPub in 2020. Book page.