[Haskell-cafe] Re: about Haskell code written to be "too smart"
barsoap at web.de
Wed Mar 25 09:47:04 EDT 2009
Manlio Perillo <manlio_perillo at libero.it> wrote:
> The main problem, here, is that:
> - recursion and pattern matching are explained in every tutorial about
> functional programming and Haskell.
> This is the reason why I find them more "natural".
Well, you're going to have a hard time writing a BASIC tutorial without
mentioning GOTO. While surely it has to be there, for the sake of
completeness of fundamentals, I completely agree that...
> - high level, Haskell specific, abstractions, are *not* explained in
> normal tutorials or books.
> The libraries where these concepts are implemented, are not well
> Most of the "documentation" is in research papers, and a "normal"
> programmer don't want to read these papers.
> Only in the recent "Real World Haskell", all these high level
> abstraction have been properly documented
...GOTO alone doesn't teach you how to write a loop, trust me, I was
stuck there for a good while, eons ago.
The prelude, as well as commonly used functions that should be in
there, utterly lack accompanying documentation. There should be no
function without a usage, as in foldl/sum/product, and no usage without
explanation why foldl is chosen over foldl' and foldr. Think of a
Preludopedia, accompanying the Typeclassopedia: Documentation where you
don't have to snatch understanding out of assem^H^H^H^H^H^H code
written using primitive recursion, to make it a bit easier to see the
wood despite of all those trees.
PS: Shouldn't zipWith be defined in terms of zip, uncurry and map
zipWith f (a:as) (b:bs) = f a b : zipWith f as bs
zipWith _ _ _ = 
(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