Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split standard library docs up one page per module. #5636

Merged
merged 7 commits into from
Apr 22, 2020
Merged

Conversation

sofiafaro-da
Copy link
Contributor

@sofiafaro-da sofiafaro-da commented Apr 20, 2020

Fixes #3172

This PR updates our standard library docs to put each module on its own page. Users can easily navigate the docs by using the table of contents on the left, or the standard library page.

Here's a preview:

image

Summary of changes:

  • Redid & pruned some bazel rules to get multiple outputs.
  • Adjusted the daml-doc RST renderer output to support cross-reference links.
  • Added a module index that just lists all the modules. This is also used to generate the navigation (automatically) in RST docs.
  • Added an --index-template option to daml-docs, so you can have a separate template for the module index and individual modules. This was used to make the "standard library" page.
  • Small annotation changes in the standard library to hide modules that should be hidden, and move other modules to the correct place.

TODO before merging:

  • Fix hoogle database URLs.

This change also highlights how a lot of our standard library documentation could be improved. Most modules don't yet have any description. Also, it might be better to put data types before typeclasses in each module doc. I will leave further documentation changes to a separate PR.

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

Copy link
Contributor

@cocreature cocreature left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks! Do we need a redirect from the old docs url or does that just point to the main docs page that lists all modules?

compiler/damlc/base-rst-index-template.rst Outdated Show resolved Hide resolved
@@ -5,7 +5,7 @@
{-# OPTIONS_GHC -fno-warn-unused-imports #-}


-- Remove this module when DEL-6311 is done.
-- | HIDE Remove this module when DEL-6311 is done.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotta love comments that refer to jira tickets that have been fixed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we just remove this file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about it, we fixed this for damlc build but we use damlc compile to compile daml-stdlib so it doesn’t help.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably ... I'm going to go through the stdlib in a separate PR to clean up docs and I'll try removing it then.

@@ -4,7 +4,7 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE PatternSynonyms #-}

-- | Our Prelude, extending WiredIn with things that don't need special treatment.
-- | HIDE Our Prelude, extending WiredIn with things that don't need special treatment.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment doesn’t make sense to me.

compiler/damlc/daml-stdlib-src/DA/Generics.daml Outdated Show resolved Hide resolved
@sofiafaro-da
Copy link
Contributor Author

Awesome, thanks! Do we need a redirect from the old docs url or does that just point to the main docs page that lists all modules?

That sounds like a good idea, I'll add that.

@sofiafaro-da
Copy link
Contributor Author

sofiafaro-da commented Apr 21, 2020

I made some more changes:

  • Moved the standard library to daml/stdlib (instead of daml/reference/base), which reflects where it actually is in the docs (there's a whole history here that I don't want to get into ... but suffice it to say that this is where the standard library docs should have been before this PR, but weren't, but there's no longer a reason to have it this way).

  • Updated the existing standard library redirects, and added a redirect from daml/reference/base.html to daml/stdlib/index.html.

  • Changed the way modules are listed ... I removed the Module prefix from the index / navigation because I think it looked a bit goofy.

  • Updated the live preview script.

  • Updated the hoogle base URL, the URL for generated Hoogle links, and the builtin damlBaseURL used for external links to the standard library. This is a little bit better than pointing to an old page, but it's still not correct in general, especially for Hoogle. The problem is that the way Hoogle is generated right now isn't very amenable to putting in the correct links.

  • Updated the tests.

If possible, I'll work on improving the Hoogle database in a separate PR. I don't want to make this one any larger than it already is... (Right now the behavior is that if you click on a hoogle link, it will take you to the standard library index instead of the exact module you want. That was only fine when everything was on the same page.)

Copy link
Contributor

@hurryabit hurryabit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output looks great. Thank you so much!

sofiafaro-da and others added 7 commits April 22, 2020 13:09
changelog_begin

- [DAML Docs] The standard library docs have been split up per module.

changelog_end
Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Co-Authored-By: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

damldocs: Split standard library docs into one page per module.
3 participants