Functional Design and Architecture (book)

Hello, my name is Alexander Granin, and this is the official page of my book
«Functional Design and Architecture».

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.

The book is very practical. 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.

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.

The draft of book is published online. You’ll find links here. Buy this book, and you’ll get access to the complete edition in PDF and ePub, additional learning materials (6+ educational videos), and even a paper version of the book (please send be PurchaseID and the shipping address by email, and I’ll send you a physical copy of the book for free).

Buy «Functional Design and Architecture» on Leanpub


  • Architecture modelling, requirements analysis, subsystems design from the FP point of view
  • Layering
  • Embedded and external DSLs and domain modelling
  • Subsystems and services
  • Free Monads as functional interfaces
  • Other types of functional interfaces: Final Tagless, ReaderT pattern, Service Handle Pattern, GADTs
  • Hierarchical Free Monads as a basis for effects
  • Frameworks
  • Inversion of Control and Dependency Injection in FP
  • Applicability of the mainstream techniques and principles such as UML, SOLID, GRASP
  • Interaction with impure subsystems
  • Project structuring
  • Incorporation of SQL DBs, KV DBs
  • Design of business logic
  • Design of web services and console applications
  • And many other high-level topics

Related projects and materials

The «FDaA» book is project-based. Actually, 2-projects-based at the moment.

  • Andromeda

    A SCADA-like application and simulator for star ships controlling. The first 5 chapters of the book describe the architecture and design of this project.
  • Hydra

    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.

There are several real-world projects based on the ideas from the book:

  • Node, a real-world all-in-one framework which is tested in production. It allows to build network actors and blockchain protocols, console applications, work with KV database and cryptography. Sample but not simple blockchain applications are also provided there.
  • PureScript Presto — a framework for building mobile apps using a handy eDSL.
  • PureScript Presto.Backend — a framework for web RESTful backends.

My articles about Hierarchical Free Monads:

I’m also giving talks on this topic.



I’m very thankful to all the community and people who gave the light to this project.

  • My wife 🙂
  • Manning Publications: editors, correctors, managers and other people related to the project. They did a lot of work over the first five chapters of the book.
  • Reviewers and readers who made a lot of suggestions how to improve the book.
  • All my Patrons and supporters:
    • Imran Settuba
    • Vasiliy Yorkin
    • Andrei Dziahel
    • Ivan Zemlyachenko
    • Yuriy Syrovetskiy
    • Pavel Dmytriiev
    • Anatolii Prylutskyi
    • Alessandro Pezzato
    • Олег Дмитриенко
    • Sergey Kintsel
    • Mikhail Gaidamaka
    • Tim
    • Vladimir Krivopalov
    • James Bartholomew
    • Fabian
    • Steven Paul Leiva
    • Mikhail Shustov
    • eb31b2cmikqbvcq8
    • Simon Bosse
    • Alexey Lebedeff
    • Vimal Kumar
    • Gabriele Lana
    • Adil
    • ekim boran danişger
    • Eduardo Moritz Cavalcanti
    • Andrei Orlov
    • Artur Yushchenko
    • SleepingCat
    • Anton Selyanin
    • Reynaldo Cordero
    • Alexander Kucherenko
    • Ashutosh Das
    • Dorzhi Tarbaev
    • Igal Tabachnik
    • Maxim Yaskevich
    • Ilia Rodionov
    • Angel Vanegas
    • Evgeny Lyutikov
    • Vadim Sotnikov
    • Sergey Homa
    • Allan Lukwago
    • Hécate
    • James Fielder
    • C++ User Group, Russia
    • Yaroslav Voloshchuk
    • Bogicevic Sasa
    • Vasily Gorev
    • Victor Savkov
    • Julian Wilke
    • Robert Gubin
    • Артем Миклушов
    • Olaf
    • Yuriy Pitometsu
    • Eugen Wissner
    • Tyler Weir
    • Grammarly
    • Jon Fast
    • Henry Laxen
    • Sandy Maguire
    • John Walker
    • erc
    • pluton
    • Evgeny Pogrebnyak
    • Donald Johnson
    • Mathew Fournier
    • Aleksey Sazonov
    • Alex Morgun
    • Nikita Puzankov
    • Christopher Miller
    • Innocent Ndubuisi-Obi Jr
    • Florian Pieper
    • Ivan Tester
    • Andrey Shinkevich
    • Daniel Gräber
    • Eugene Tulushev
    • Jonathan Thaler
    • Dmitriy Zakomirnyi
    • Swanand Kriyaban
    • Andrii Sergiienko
    • Sean
    • rohit
    • Imre Gulyas
    • Enzo Luis Strongoli
    • Ian
    • Martin Frické
    • John Man
    • Martin Allard
    • Mefire Omar
    • Matt Braun
    • Patryk Zieliński
    • Simon Shine
    • Cezar Halmagean
    • Anand Haridas
    • Brian Lane
    • Vitalii Skakun
    • Rui Morais
    • Francesco Zanini
    • Samael