Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Haskell Design Patterns

You're reading from   Haskell Design Patterns Take your Haskell and functional programming skills to the next level by exploring new idioms and design patterns

Arrow left icon
Product type Paperback
Published in Nov 2015
Publisher
ISBN-13 9781783988723
Length 166 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ryan Lemmer Ryan Lemmer
Author Profile Icon Ryan Lemmer
Ryan Lemmer
Arrow right icon
View More author details
Toc

Chapter 1. Functional Patterns – the Building Blocks

Software design patterns were forged at a time when object oriented programming (OOP) reigned. This led to "design patterns" becoming somewhat synonymous with "OOP design patterns". But design patterns are solutions to problems, and "problems" are relative to the strengths and weaknesses of the context in which they occur. A design problem in OOP is not necessarily one in functional programming (FP), and vice versa.

From a Haskell perspective, many (but not all) of the well known "Gang of Four" patterns [Design patterns, Gamma et al.] become so easy to solve that it is not worth going to the trouble of treating them as patterns. However, design patterns remain relevant for Haskell.

 

"After al, as Erich Gamma said, "deja vu is language neutral"

Modularity means more than modules. Our ability to de-compose a problem into parts depends directly on our ability to glue solutions together. To support modular programming, a language must provide good glue."

 
 --Why Functional Programming Matters - John Hughes

In order to have a meaningful conversation about Haskell design patterns, we'll begin our exploration by looking at the three primary kinds of "glue" in Haskell: first-class functions, the Haskell type system, and lazy evaluation. This chapter revisits the Haskell you already know through the lens of design patterns, and looks at:

  • Higher-order functions
  • Currying
  • Recursion
  • Types, pattern matching, polymorphism
  • Lazy Evaluation
  • Monads
You have been reading a chapter from
Haskell Design Patterns
Published in: Nov 2015
Publisher:
ISBN-13: 9781783988723
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image