[Haskell-cafe] Re: Problems with strictness analysis?

Achim Schneider barsoap at web.de
Wed Nov 5 06:33:53 EST 2008

Henning Thielemann <schlepptop at henning-thielemann.de> wrote:

> Achim Schneider schrieb:
> > Derek Elkins <derek.a.elkins at gmail.com> wrote:
> > 
> >> well-known anti-patterns
> >>
> > I'm wondering why there are so miraculously well-known. Could it be
> > the dedicated wiki page titled "DONTDOTHAT!!!one!" that lists them
> > all?
> There was
>   http://www.haskell.org/haskellwiki/Things_to_avoid
> which has been renamed to the more friendly
>   "Haskell programming tips"
I was rather thinking of a list of performance pitfalls and laziness
tarpits, starting with the all-famous

avg xs = sum xs + length xs

The above link seems to consist purely of advice about style and how to
avoid imperative thinking, and does not do much to take the fear out of
FP and laziness I commonly notice in e.g. C++ programmers: Seeing
Haskell, they just don't know what the heck is going on. A list of such
things like avg above and stuff like

lastInt = last [1..]

and explanations on why and how they work (and maybe still don't work)
would surely be helpful for people who don't intend or don't even
start to consider to read into SPJ's GHC papers.

I know that I, coming from a C/Scheme POV, in the beginning attributed
much magic to Haskell's inner workings and assumed, because of the
general wizardly air of the whole language, avg to run in O(n) time and
constant resp. O(n) space.

(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.

More information about the Haskell-Cafe mailing list