Skip to content

[#768] Option to flatten EpdRecursive entrypoints in autodoc

NB: this is one possible solution. For other reasonable options considered, see below.

It's also seemingly not impossible to filter the offending doc items after the fact, but in practice that ends up being pretty fiddly and brittle, so doesn't seem like a great option.

Description

Problem: For parameters with entrypoint derivation type of EpdRecursive, intermediary nodes are treated as entrypoints of their own by autodoc. This gets especially weird if there is an explicit default entrypoint, then those intermediary nodes read

Feel sad: this entrypoint cannot be called and is enlisted here only to describe the parameter structure.

Generally speaking, we'd like to at least have an option to skip over these intermediary nodes.

Solution: Introduce a new entrypoints kind, FlattenedEntrypointsKind, and add an overlapping instance for GDocumentEntrypoints matching this case on nodes. Add EPTree parameter to GDocumentEntrypoints to track whether it's on EPNode or not.

Other options considered:

  • Do this for all entrypoint kinds. For backwards compatibility reasons, a new entrypoint kind was introduced instead. Also this lets us avoid incoherent instances.
  • Avoid overlapping instances. With special entrypoint kind basically impossible since entrypoint kinds are open; but also gets into trouble with arbitrary entrypoint kinds as well because BuildEPTree gets stuck on types that don't have ParameterHasEntrypoints instance; that limits entryCase to only work on types that explicitly declare ParameterHasEntrypoints, and that also breaks backwards compatibility.

Related issue(s)

Resolves #768 (closed), #462 (closed)

Checklist for your Merge Request

Related changes (conditional)

  • Tests (see short guidelines)

    • If I added new functionality, I added tests covering it.
    • If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
  • Documentation

    • I checked whether I should update the docs and did so if necessary:
    • I updated changelog files of all affected packages released to Hackage if my changes are externally visible.

Stylistic guide (mandatory)

Edited by Nikolay Yakimov

Merge request reports