Haskell Design Patterns
By Ryan Lemmer
Publisher: Packt Publishing
Final Release Date: November 2015
Pages: 166

Take your Haskell and functional programming skills to the next level by exploring new idioms and design patterns

About This Book

  • Explore Haskell on a higher level through idioms and patterns
  • Get an in-depth look into the three strongholds of Haskell: higher-order functions, the Type system, and Lazy evaluation
  • Expand your understanding of Haskell and functional programming, one line of executable code at a time

Who This Book Is For

If you're a Haskell programmer with a firm grasp of the basics and ready to move more deeply into modern idiomatic Haskell programming, then this book is for you.

What You Will Learn

  • Understand the relationship between the “Gang of Four” OOP Design Patterns and Haskell
  • Try out three ways of Streaming I/O: imperative, Lazy, and Iteratee based
  • Explore the pervasive pattern of Composition: from function composition through to high-level composition with Lenses
  • Synthesize Functor, Applicative, Arrow and Monad in a single conceptual framework
  • Follow the grand arc of Fold and Map on lists all the way to their culmination in Lenses and Generic Programming
  • Get a taste of Type-level programming in Haskell and how this relates to dependently-typed programming
  • Retrace the evolution, one key language extension at a time, of the Haskell Type and Kind systems
  • Place the elements of modern Haskell in a historical framework

In Detail

Design patterns and idioms can widen our perspective by showing us where to look, what to look at, and ultimately how to see what we are looking at. At their best, patterns are a shorthand method of communicating better ways to code (writing less, more maintainable, and more efficient code).

This book starts with Haskell 98 and through the lens of patterns and idioms investigates the key advances and programming styles that together make "modern Haskell". Your journey begins with the three pillars of Haskell. Then you'll experience the problem with Lazy I/O, together with a solution. You'll also trace the hierarchy formed by Functor, Applicative, Arrow, and Monad. Next you'll explore how Fold and Map are generalized by Foldable and Traversable, which in turn is unified in a broader context by functional Lenses. You'll delve more deeply into the Type system, which will prepare you for an overview of Generic programming. In conclusion you go to the edge of Haskell by investigating the Kind system and how this relates to Dependently-typed programming.

Style and approach

Using short pieces of executable code, this guide gradually explores the broad pattern landscape of modern Haskell. Ideas are presented in their historical context and arrived at through intuitive derivations, always with a focus on the problems they solve.

Product Details
Recommended for You
Customer Reviews

REVIEW SNAPSHOT®

by PowerReviews
oreillyHaskell Design Patterns
 
2.0

(based on 1 review)

Ratings Distribution

  • 5 Stars

     

    (0)

  • 4 Stars

     

    (0)

  • 3 Stars

     

    (0)

  • 2 Stars

     

    (1)

  • 1 Stars

     

    (0)

Reviewed by 1 customer

Displaying review 1

Back to top

 
2.0

Cannot recommend this book

By Eike

from Berlin

About Me Developer

Pros

    Cons

    • Not comprehensive enough
    • Too many errors

    Best Uses

      Comments about oreilly Haskell Design Patterns:

      From the use of the terms design patterns and GoF, I was expecting a structure that describes commonly encountered "problems" in haskell, and their solution. It doesn't.

      If you know about functor, applicative, and monad, you will not learn much from about a 3rd of the book. If you know about them, I think there are much better resources to learn from. (For example the book does not talk about sequencing of effects with applicative functors.)

      The section about arrows tries to follow "problem -> solution" pattern, but fails to provide an actual problem to solve.
      The supposed problem is that we cannot write "print . length . words . readFile".
      The proposed solution with arrows is "Kleisli print . arr length . arr words . Kleisli readFile",
      which is actually worse than the purely monadic solution "print < =< return . length < =< return . words < =< readFile".
      Afterwards the author asks the question "why arrows?", giving an answer that is completely unrelated to the previous, and not explained in more detail.

      The section about folds claims that foldl is strict, and never mentions foldl'.

      In the book there are some funny, incomplete comparisons to OO design patterns, for example simply saying that traversal is the iterator pattern. But what about early termination? What about backwards iteration? What about iterating while doing funny computations? If you compare to OO design patterns, then do a serious comparison, taking into account the practical use cases of the pattern.

      At many places the book talks long about not very enlightening things, just to go not deep enough when it actually becomes complicated.

      The examples that are used throughout the book are simple and boring. I do not intend to write an expression language, and IO and Maybe are not the only monads.

      Displaying review 1

      Back to top

       
      Buy 2 Get 1 Free Free Shipping Guarantee
      Buying Options
      Immediate Access - Go Digital what's this?
      Ebook:  $27.99
      Formats:  ePub, Mobi, PDF