Skip to content

Add first class support for GHC Notes Syntax #2964

Closed as not planned
Closed as not planned
@fendor

Description

@fendor

This feature has been proposed by SPJ during ZuriHac 2022.

Essentially, GHC has many Notes to explain the code-base, ghcide has these too, and they look like this:

{- Note [Avoiding bad interface files]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
-}

And these notes are often references in documentation for functions like this:
image

The issue is, that there is no way to actually find the note from the documentation without resorting to a basic grep search.
This UX is acceptable, but maybe we can do better!
The idea presenting here is the following:

  • Inline the comment in the haddock documentation when displayed to the user
  • Alternatively: Make the syntax Note [Avoiding bad interface files] clickable, allowing users to jump to the original note, allowing them to more easily discover the information.

As an alternative design space, maybe we can teach haddock in general about references to other comment sections?

Note: If standardised, this feature is useful for more than just the GHC codebase, but beneficial to the whole community.

Possible roadmap:

  1. Standardise the GHC Note system
  2. Figure out how to automatically create an index of available Notes in a local project.
    • .hie files might provide this information, also haddock (which I think depends on .hie, right?).
  3. Find notes from dependencies
    • again, .hie files or haddock.
  4. Display notes to users

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions