Pragmatic Type-Level Design (PTLD E-Book)
Minimum price
Suggested price

Pragmatic Type-Level Design

Practical introduction into Haskell types: design principles, design patterns, methodologies, approaches

About the Book

Pragmatic Type-Level Design is a book about programming in types, about the discipline of Software Design, lifted onto the level of types, and about type-level approaches useful in real practice.

This is my second fundamental book about Software Design in Haskell, in addition to Functional Design and Architecture (First Edition, 100% ready; Second Edition with Manning, WIP).

The main goal of this book is to be the best source of knowledge, well-written and well-structured. I’m not only talking about type-level features but providing a reasoning framework for making the narrative complete and comprehensive. The central philosophy of this book - pragmatism - is used to build a practice-first methodology on how to approach types and do not drown in the related complexity. The type-level design is difficult on its own, type-level Haskell features are difficult as well, and there is no need in raising the learning bar even more.

The book will be useful for Haskellers who want to start doing real things on the type level and who are scared out by the academism-styled materials.


If you liked my FDaA book, you’ll find PTLD quite enlightening and complementary to it.

Book completion estimation: mid of 2023

Book topics:

type-level design

type-level eDSLs

complexity of solutions

type-level Haskell features

Inversion of Control and Dependency Injection

domain modeling

type-level functional interfaces

design of business logic

interaction with impure subsystems


GitHub repo: Pragmatic-Type-Level-Design

  • Share this book

  • Categories

    • Software Engineering
    • Haskell
    • Functional Programming
    • Software Architecture
  • Feedback

    Email the Author(s)

About the Author

Alexander Granin
Alexander Granin

International speaker, researcher, author

Expert Haskell and C++ developer

Software architect, team lead

Haskell consultant

Author of the book "Functional Design and Architecture"

Table of Contents

  • Part I Type-level software design
    • 1 Approaching the type-level design?
      • 1.1 Static types and correctness
        • 1.1.1 Correctness of data structures
        • 1.1.2 Correctness of data models
        • 1.1.3 Correctness of languages
      • 1.2 Emergent type-level design
        • 1.2.1 Type-level versus type-safe
        • 1.2.2 Terminology, base principles, and philosophy
        • 1.2.3 Use cases for the type-level design
      • 1.3 The foreshadowing of extensibility
        • 1.3.1 The variety of variations
        • 1.3.2 Extension points and interfaces
        • 1.3.3 Preparing the ground
        • 1.3.4 Not an extensibility and not a design
      • 1.4 Summary
    • 2 Type-level design basics
      • 2.1 Drafting the design
        • 2.1.1 Simple type class
        • 2.1.2 The critique of the simple design
      • 2.2 Four cardinal points of a type class
        • 2.2.1 Multiparameter type class
        • 2.2.2 Type class with a functional dependency
        • 2.2.3 Type class with an associated type
        • 2.2.4 Type class with an associated ADT
        • 2.2.5 Why type-level features are hard
      • 2.3 Summary
  • Part II Type-level domain-specific languages (TODO)

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $12 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub