[Haskell-cafe] Design Patterns by Gamma or equivalent

ajb at spamcop.net ajb at spamcop.net
Mon Mar 16 01:56:40 EDT 2009

G'day all.

Quoting wren ng thornton <wren at freegeek.org>:

> Most of the (particular) problems OO design patterns solve are
> non-issues in Haskell because the language is more expressive.

...and vice versa.  Some of the "design patterns" that we use in
Haskell, for example, are to overcome the fact that Haskell doesn't
have mutable global state.

> A number of other patterns can
> actually be written down once and for all (in higher-order functions
> like foldr, map,...) instead of needing repetition.

This is also true in many OO languages.  A lot of the GoF book, for
example, can be implemented as libraries in Ada or C++.

> And then there are some things like monoids which fall somewhere
> between idiom and pearl.

"Things like monoids" are constructions from algebra.

Abstract algebra and design patterns have a lot in common.  They're
based on the same idea, in fact: When a pattern keeps showing up,
define it and give it a name so you can talk about it independently
of any specific implementation.

Or to put it another way, category theory is the pattern language of

Andrew Bromage

More information about the Haskell-Cafe mailing list