On Thu, 9 Sep 1999, George Russell wrote:

> Here is my revised version of the documentation.  Sorry I can't
> manage the pretty formatting:
> 
> unzip :: [(a,b)] -> ([a],[b])
> -----
> Description:
>    unzip takes a list of pairs and returns a pair of lists.

Minor quibble: the verbal description says precisely the same thing as the
type declaration. Perhaps I misunderstood why Erik's response about
looking at types was believed to be inappropriate for real beginners. I
thought it wasn't that reading type signatures was too hard (IMO if you
don't learn how to read type signatures (without classes & overloading) as
one of the first things about Haskell you'll go demented trying to figure
out why your first teetering example programs cause Hugs errors.) The
thing is that that although types give certain kinids of theorems for free
and, if you're experienced you can make a first guess that a function
probably makes the most natural morphism between its arguments and its
result, it takes a while to get an idea of what's natural; in any case
this isn't always reliable: from the type signature [a]->[a] is `most
naturally' id, but it could actually be tail, reverse, .... How about a
description which, even if informal and perhaps even slightly inaccurate,
conveys the essential idea of what a function does, eg for unzip,

Description:
    gives the pair of lists formed by reading respectively only the first
    or second components as you go along the input list.

OK, it's now 2 lines but i'd argue it's a bit more intuitive.

___cheers,_dave______________________________________________________
email: [EMAIL PROTECTED]       "He'd stay up all night inventing an
www.cs.bris.ac.uk/~tweed/pi.htm   alarm clock to ensure he woke early
work tel: (0117) 954-5253         the next morning"-- Terry Pratchett





Reply via email to