Re: Data.List documentation improvements

I submitted a proposal ticket for this patch:
http://hackage.haskell.org/trac/ghc/ticket/1034
The deadline is Wednesday, December 6th.
Andriy
----- Original Message ----
From: Andriy Palamarchuk

Hi
The deadline is Wednesday, December 6th.
That's incredibly soon, two days is just not enough time to do anything! I recommend a minimum deadline of a week for anything, some people may only catch up with their Haskell mail a couple of times a week. As for your patch, I think its great, and its exactly the type of thing that should be in the libraries documentation for pretty much everything. My only suggestion would be to include the "corner" cases: take 3 [1] = [1] drop 3 [1] = [] (ditto splitAt) i.e. show that they produce a result, not an error. Thanks Neil
----- Original Message ---- From: Andriy Palamarchuk
To: libraries@haskell.org Sent: Friday, December 1, 2006 9:53:08 PM Subject: Data.List documentation improvements Goal of my changes it to make list functions more accessible to Haskell newcomers. "Extracting sublists" section seems to have less complete documentation than rest of the module.
Added examples for all the functions. Added easier to understand summaries for composite functions.
Comments, suggestions, better descriptions?
Is it Ok to send the darcs patches as is or it is better to send only diffs without context? I'd like to keep patch in plain text, not compressed.
Thanks, Andriy
____________________________________________________________________________________ Cheap talk? Check out Yahoo! Messenger's low PC-to-Phone call rates. http://voice.yahoo.com _______________________________________________ Libraries mailing list Libraries@haskell.org http://www.haskell.org/mailman/listinfo/libraries

ndmitchell:
Hi
The deadline is Wednesday, December 6th.
That's incredibly soon, two days is just not enough time to do anything! I recommend a minimum deadline of a week for anything, some people may only catch up with their Haskell mail a couple of times a week.
As for your patch, I think its great, and its exactly the type of thing that should be in the libraries documentation for pretty much everything. My only suggestion would be to include the "corner" cases:
take 3 [1] = [1] drop 3 [1] = []
(ditto splitAt)
i.e. show that they produce a result, not an error.
In general, what do people think about adding examples by default to anything we want in the libraries? Are people ok with this? If so, we should add some guidelines for their constructoin: I.e. * general cases * corner cases and for some things, like the monad transformers: * entire programs Seem reasonable? If so, i'll add some notes to the documentation suggetions. -- Don

Hi
In general, what do people think about adding examples by default to anything we want in the libraries? Are people ok with this?
Personally, yes, I think its a great idea.
I.e. * general cases * corner cases
Perhaps additionally a few QuickCheck style properties where that helps.
and for some things, like the monad transformers:
* entire programs
I think what is really needed is for Haddock to have some kind of "show source" link that shows the source for a function inline in the documentation without opening a new page. Often the best documentation for a function is its definition. Thanks Neil

| I think what is really needed is for Haddock to have some kind of | "show source" link that shows the source for a function inline in the | documentation without opening a new page. Often the best documentation | for a function is its definition. I believe that Simon M has already implemented exactly that. I'm not sure whether it takes extra flags or what. Simon

Hi
| I think what is really needed is for Haddock to have some kind of | "show source" link that shows the source for a function inline in the | documentation without opening a new page. Often the best documentation | for a function is its definition.
I believe that Simon M has already implemented exactly that. I'm not sure whether it takes extra flags or what.
He has implemented something similar, see http://www-users.cs.york.ac.uk/~ndm/projects/filepath/System-FilePath-Versio... for an example - click on the source link and it hops to the right place (using HsColour to colourise and tag the source file). I was more thinking of an "AJAX style" thing where the documentation appears in the same page, rather than linking to a separate page which contains it. Thanks Neil

Neil Mitchell wrote:
Hi
| I think what is really needed is for Haddock to have some kind of | "show source" link that shows the source for a function inline in the | documentation without opening a new page. Often the best documentation | for a function is its definition.
I believe that Simon M has already implemented exactly that. I'm not sure whether it takes extra flags or what.
He has implemented something similar, see http://www-users.cs.york.ac.uk/~ndm/projects/filepath/System-FilePath-Versio...
for an example - click on the source link and it hops to the right place (using HsColour to colourise and tag the source file).
Much as I'd like to take the credit, it was Duncan Coutts who implemented that feature :)
I was more thinking of an "AJAX style" thing where the documentation appears in the same page, rather than linking to a separate page which contains it.
That would certainly be neat. Maybe it could be implemented in Haskell using YHC's JavaScript backend? (half-joking...) AJAX requires a server, and the nice thing about Haddock documentation is you can view it with file:// URLs. Maybe there's a way around this though, I'm not an AJAX expert. Cheers, Simon

Hi
That would certainly be neat. Maybe it could be implemented in Haskell using YHC's JavaScript backend? (half-joking...)
Thats how Hoogle 4 is going to be implemented...
AJAX requires a server, and the nice thing about Haddock documentation is you can view it with file:// URLs. Maybe there's a way around this though, I'm not an AJAX expert.
By "AJAX style" I meant: <a href="javascript:show_code('map')">Show Code</a> <div id="code_map" style="display:none;"> code for map goes here </div> No need for a server, I guess what I really meant was with DHTML, but no one seems to use the name DHTML, everyone now refers to it as AJAX. The acronyms have attacked! Thanks Neil

Neil Mitchell wrote:
Hi
That would certainly be neat. Maybe it could be implemented in Haskell using YHC's JavaScript backend? (half-joking...)
Thats how Hoogle 4 is going to be implemented...
AJAX requires a server, and the nice thing about Haddock documentation is you can view it with file:// URLs. Maybe there's a way around this though, I'm not an AJAX expert.
By "AJAX style" I meant:
<a href="javascript:show_code('map')">Show Code</a> <div id="code_map" style="display:none;"> code for map goes here </div>
No need for a server,
Right, that would be easier. I'm a bit concerned that the concept of "the code for a function" is not as simple as it seems. Including just the code for the function itself often won't be useful, because it might be something like myFunction x y z = myFunction' x y z [] so then do we include the transitive closure of code referenced by the function? What if we refer to something in a different file, or scattered around the current file? What about CPP? Presumably functions that are documented elsewhere should be rendered as links. etc. etc. Just linking to a point in the source file is much easier. Making the "include source code" feature optional on a per-function basis would probably make sense, though. Cheers, Simon

Hi
myFunction x y z = myFunction' x y z []
so then do we include the transitive closure of code referenced by the function? What if we refer to something in a different file, or scattered around the current file? What about CPP? Presumably functions that are documented elsewhere should be rendered as links. etc. etc.
What I did for Hoogle 2 is to give definitions for the functions which didn't match the way it was really defined, but did match the semantics. Maybe some way of tagging "here is the code for the function, but please hide it by default" is what's required. You are definately correct that the real implementation is probably not the best for documentation purposes. Thanks Neil

On 05/12/06, Simon Marlow
I'm a bit concerned that the concept of "the code for a function" is not as simple as it seems. Including just the code for the function itself often won't be useful, because it might be something like
myFunction x y z = myFunction' x y z []
so then do we include the transitive closure of code referenced by the function? What if we refer to something in a different file, or scattered around the current file? What about CPP? Presumably functions that are documented elsewhere should be rendered as links. etc. etc.
My vote for myFunction would be to just show the RHS, but link myFunction' to its own documentation and source link. A nice touch would be to automatically expand the source section of the target function if the user followed a link from another function's source. -- -David House, dmhouse@gmail.com

David House wrote:
On 05/12/06, Simon Marlow
wrote: I'm a bit concerned that the concept of "the code for a function" is not as simple as it seems. Including just the code for the function itself often won't be useful, because it might be something like
myFunction x y z = myFunction' x y z []
so then do we include the transitive closure of code referenced by the function? What if we refer to something in a different file, or scattered around the current file? What about CPP? Presumably functions that are documented elsewhere should be rendered as links. etc. etc.
My vote for myFunction would be to just show the RHS, but link myFunction' to its own documentation and source link.
The point is that myFunction' is an internal function, not exported and not documented, so we can't (and don't want to) give it first class status in the documentation. Cheers, Simon
participants (6)
-
Andriy Palamarchuk
-
David House
-
dons@cse.unsw.edu.au
-
Neil Mitchell
-
Simon Marlow
-
Simon Peyton-Jones