Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

I would like to improve the API documentation #142

Open

Description

@marick

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.

Activity

  1. michaelficarra commented on Apr 7, 2018

    @michaelficarra

    Maybe it would be enough if the documentation generator had a way to mark some exports as "priority" for documentation purposes?

  2. hdgarrood commented on Apr 7, 2018

    @hdgarrood
    Contributor
  3. marick commented on Apr 7, 2018

    @marick
    Author

    Will do some rearranging.

  4. marick commented on Apr 7, 2018

    @marick
    Author

    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.

  5. hdgarrood commented on Apr 8, 2018

    @hdgarrood
    Contributor

    Are you using an old compiler?

  6. marick commented on Apr 8, 2018

    @marick
    Author

    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.

  7. marick commented on Apr 8, 2018

    @marick
    Author

    (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
      ) where
  8. hdgarrood commented on Apr 10, 2018

    @hdgarrood
    Contributor

    That looks good to me, yep!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions