revisit/cleanup how numbered args are generated and used
We have Output (the original) and NumberedOutput (meant for numbered args, but especially for generating and numbering output at the same time), and evidently (as seen in #4601, #4603) started to diverge in how we create numbered args.
I remember finding
respondNumberedawkward to use in some cases, and usingrespond+ manually setting numbered args is more flexible (though also more error prone)
Let's discuss whether we want to continue to have two kinds of output, two ways of setting numbered args, or whether there's something we can do to consolidate and facilitate their use.
Restated: Review the current respondNumbered design, and decide if it's worth it to make it better? And/or make a plan to convert to whatever consistent thing.
I think NumberedOutput is the right direction, but could go farther with sharing logic between the pretty output and the numbered args.
Here are some thoughts:
- we don’t need
Outputas well – outputs without numbered results can just return the empty list of numbered args (which no longer causes the previous numbered args to be cleared) and - instead of
notifyNumbered :: NumberedOutput -> (Pretty, [StructuredArgument]), the type should be something more likenotifyNumbered :: NumberedOutput -> ([(Section, [a])], forall f. (Functor f) => [(Section, f a)] -> Pretty, forall f. (Functor f) => f a -> f StructuredArgument), which would help ensure that thePrettyand numberedArgs are built from the same list of results.