Haskell Patterns


I've start developing a small game, so that I had a project where I could abuse Haskell's features in any way I could think of. It has been a most educative venture, but I've notice I'm making more experiments than I'm able to memorize the results.

Thus, I've decided to catalog here the patterns I've used on my code, so I have a useful reference for later, and not just a toy project lost into my homedir noise.

I've created a name for most of the patterns bellow, not because I created them - I don't think I'm the inventor of any - but just because most weren't named, hadn't unique or simple enough names for them being useful, or I simply couldn't find their name on any simple search.

Finally, software design patterns are a language smell, yet, not all patterns are created the same. Those patterns here share the characteristic that they require very little repetitive code, that buy you a lot (sometimes too much) of functionality in exchange. That small amount of repetition is evidence that Haskell is not perfect, but I don't think anybody is claiming it was anyway.

Local Patterns

Patterns that apply to a few lines of code, inside a single function or through a small number of them.

Module Patterns

Patterns that apply to a single module, or a small number of modules that share a logical application.

Structural Patterns

Patterns that guide the overall way a program is structured.