Preventing/handling space leaks

Henk-Jan van Tuyl Henk-Jan.van.Tuyl at
Thu Dec 11 16:34:55 EST 2003


On Wed, 10 Dec 2003 09:49:54 -0800, Iavor S. Diatchki <diatchki at> wrote:

> hello,
> Henk-Jan van Tuyl wrote:
>> So far I have seen only one rule for Good Coding Practice in Haskell: Do Not Use n+k Patterns. I hope someone can give some directions, how to avoid known pitfalls (especially Space Leaks).
> not that i am a big fan of n+k patterns but why are they bad coding practise?

1) It takes no effort, once you are use to it, to code without n+k patterns; on the other hand, when you often use these patterns, you might spend hours debugging an endless looping program. If you are working under high pressure in a large project, chances are, that the testing departement will find your bug and write a bug report (or worse, the customer might find it). Report handling and bug solving costs an enormous amount of money. This has resulted in the "clean room" approach for software design: prevent bugs rather than solve them. See also Finnagle's Law.

2) It is likely, that n+k patterns dissapear in the next Haskell standard. If you don't like to rewrite, test and debug all your software every few years, don't use any language/compiler features that are likely to dissapear. This is another thing that might cost companies a lot of money.

Best regards,
Henk-Jan van Tuyl

More information about the Haskell-Cafe mailing list