refactor: create an intermediate 'VersoDoc' data structure - #594
Merged
Conversation
robsimmons
commented
Oct 26, 2025
Collaborator
Author
|
!bench |
|
Benchmark results for c2a8615 against c15ef5d are in! @robsimmons Major changes (3)
|
Contributor
|
By the way, the results of this benchmark run may not be comparable because it's using the bundled clang. Edit: I think the parent commit has already been re-run, so you can disregard the warning. |
| /-- | ||
| Replace the metadata in a VersoDoc. | ||
|
|
||
| This is something of a hack used as a workaround in LiterateModuleDocs. |
Collaborator
There was a problem hiding this comment.
This seems like something we should be able to dispense with... What about moving the metadata line higher up in that file?
github-merge-queue Bot
pushed a commit
to leanprover/reference-manual
that referenced
this pull request
Oct 28, 2025
This change uses the temporary functions introduced into Verso alongside leanprover/verso#598, but it will remain is compatible with Verso after the `VersoDoc` intermediate data structure being introduced leanprover/verso#594 is merged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
VersoDoc genreis intended to represent an unevaluatedPart genre. The result of a#doccommand stops being syntax denoting a value of typePart genre, and becomes syntax denoting a value of typeVersoDoc genre.Presenting this indirection layer allows us for more flexibility in serializing some or all of a document in a way that minimally affects existing code. There are two alternative designs here that I considered:
VersoDoc.toPartbe monadic (returningm (Part genre)instead ofPart genre), since we might in the future want to have a part that includes a reference to an auxiliary file or data structure. Doing this seemed like it would require much more substantial changes to existing code.VersoDoc.toPartrequire an extra argument, a piece of context that can be threaded through that might represent something like serialization data in the future. This would be somewhat simpler to implement (it would be implementing the reader monad instead of an arbitrary monad).