I would like to improve the API documentation
Opened this issue · 8 comments
I come from Elm. I find its API documentation helpful because the more common functions are at the beginning.
I'm not criticizing! I want to help!
Here's the first 5 documented functions from Dict:
Build (major category)
- empty
- singleton
- update
- insert
- remove
Here are the first 5 from Data.Map:
- showTree
- empty
- isEmpty
- singleton
- checkValue
I think the Elm API documentation is better. checkValue is not important. When i want to look for a function, I find it faster in the Elm documentation.
Elm has the advantage that their doc format lets you categorize. Still, I think Data.Map API documentation could be improved with better organization. People who haven't memorized the key parts of the API want to know whether the "add a new element" function is add or insert without having to scroll past lookupLt, lookupGE, lookupGT, findSubMap, and subMap.
I volunteer to reorganize the functions in the source to put the more common ones first, if someone says they'd accept such a pull request.
Maybe it would be enough if the documentation generator had a way to mark some exports as "priority" for documentation purposes?
Will do some rearranging.
I've confirmed that moving
-- | Render a `Map` as a `String`
showTree :: forall k v. Show k => Show v => Map k v -> String
...... to the end of the file does in fact put at the end of the generated-doc list.
But rearranging the file to match the order given above is pretty problematic given 11 pull requests.
Are you using an old compiler?
I see I was not. (0.11.6 instead of 0.11.7) .
(Why does npm -g update not update purs, given that no argument is supposed to update everything? I had to give npm -g update purescript.
In any case, that fixes the ordering.
(And what happened to the comment where I reported the problem? It had the version numbers, but more importantly, I was hoping for a thumbs-up on the proposed order before fashioning a pull request.)
module Data.Map
( Map
-- creation
, empty
, singleton
, fromFoldable
, fromFoldableWith
-- common ops
, lookup
, insert
, delete
-- queries
, member
, size
, isEmpty
-- manipulation of keys and values
, keys
, values
, mapWithKey
-- less common
, update
, alter
, pop
-- setlike
, union
, unionWith
, unions
, isSubmap
-- filters
, filter
, filterWithKey
, filterKeys
-- taking advantage of Ord
, lookupLE
, lookupLT
, lookupGE
, lookupGT
, findMin
, findMax
, submap
, foldSubmap
-- Unfoldable
, toUnfoldable
, toAscUnfoldable
-- utils
, showTree
, checkValid
) whereThat looks good to me, yep!