Preface

This book is not a blow-by-blow translation of the Gang of Four design patterns (distilled out of the object-oriented programming paradigm). Having said that, wherever there is an intersection with Gang of Four patterns, we explore it more deeply.

This book is also not intended as a definitive taxonomy of patterns in functional programming or Haskell. Instead, this book is the story of modern Haskell, one pattern at a time, one line of code at a time. By following the historical arc of development, we can place the elements of modern Haskell in a conceptual framework more easily.

What this book covers

Chapter 1, Functional Patterns – the Building Blocks, explores the three pillars of Haskell, that is, first-class functions, lazy evaluation, and the Haskell type system, through the lens of patterns and idioms. We will cover some Gang of Four OOP design patterns along the way.

Chapter 2, Patterns for I/O, explores three ways of streaming I/O, that is, imperative, lazy, and iteratee based. While you're at it, learn about the problem with lazy I/O, together with a solution.

Chapter 3, Patterns for Composition, traces the hierarchy formed by functor, applicative, arrow, and monad, with a focus on how these types compose. Synthesize functor, applicative, arrow, and monad in a single conceptual framework.

Chapter 4, Patterns of Folding and Traversing, demonstrates how fold and map are generalized by Foldable and Traversable, which in turn are unified in a broader context by functional lenses.

Chapter 5, Patterns of Type Abstraction, retraces the evolution of the Haskell type system, one key language extension at a time. We'll explore RankNtypes, existensial types, phantom types, GADTs, the type-case pattern, dynamic types, heterogeneous lists, multiparameter typeclasses, and functional dependencies.

Chapter 6, Patterns of Generic Programming, delves into patterns of generic programming, with a focus on datatype generic programming. We will taste three flavors of generic programming: sum of products generic programming, origami programming, and scrap your boilerplate.

Chapter 7, Patterns of Kind Abstraction, delves into the Haskell kind system and related language extensions: associated types, type families, kind polymorphism, and type promotion. We'll get a sense of type-level programming and then conclude by going to the edge of Haskell: diving into dependently-typed programming.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset