Skip to content

feat: add Html type - #14935

Draft
Vtec234 wants to merge 1 commit into
downstream-greenfrom
html-type
Draft

feat: add Html type#14935
Vtec234 wants to merge 1 commit into
downstream-greenfrom
html-type

Conversation

@Vtec234

@Vtec234 Vtec234 commented Aug 27, 2026

Copy link
Copy Markdown
Member

Downstream adoption (not merely adaptation to make CI pass) PRs:

@Vtec234 Vtec234 added the downstream Request a downstream-lean4 adaptation PR. label Aug 27, 2026
@downstream-lean4

downstream-lean4 Bot commented Aug 27, 2026

Copy link
Copy Markdown

The adaptation PR for this PR is leanprover/downstream-lean4#25.

@Vtec234
Vtec234 changed the base branch from master to downstream-green August 27, 2026 04:08
@github-actions github-actions Bot added toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN labels Aug 27, 2026
@leanprover-bot leanprover-bot added the builds-manual CI has verified that the Lean Language Reference builds against this PR label Aug 27, 2026
@leanprover-bot

leanprover-bot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

@mathlib-lean-pr-testing mathlib-lean-pr-testing Bot added the builds-mathlib CI has verified that Mathlib builds against this PR label Aug 27, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):


instance : Coe String Html := ⟨.text⟩

/-- Append two HTML forests. -/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
/-- Append two HTML forests. -/
/-- Appends two HTML forests. -/

Indicative mood

/-- Merges an array of HTML values by appending them.

Equivalent to {name}`Html.seq`, but may produce a more compact representation. -/
def ofArray (hs : Array Html) : Html := Id.run do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this work for anything with a ForIn instance? Akin to insertMany?

letI : Quote Html `term := ⟨q⟩
mkCApp ``Html.seq #[quote s]

/-- Visit the entire tree, applying rewrites in some monad.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
/-- Visit the entire tree, applying rewrites in some monad.
/-- Visits the entire tree, applying rewrites in some monad.

Though I'd probably prefer a docstring that didn't just use the same word here. A reader who doesn't know what "visting" means won't get anything out of this.

What about instead "Recursively rewrites the entire tree bottom-up." as the summary?

It would also be nice if we had more consistent naming of these operations. Syntax has rewriteBottomUpM which is like this but without the Option and replaceM which has the Option but is top-down.


/-- Visit the entire tree, applying rewrites in some monad.
{name}`element` and {name}`seq` are applied post-traversal, receiving already-visited children.
Return {lean (type := "Option Html")}`none` to signal that no rewrite is to be performed. -/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does the Option help us here, vs having pure as the default implementation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

builds-manual CI has verified that the Lean Language Reference builds against this PR builds-mathlib CI has verified that Mathlib builds against this PR downstream Request a downstream-lean4 adaptation PR. mathlib4-nightly-available A branch for this PR exists at leanprover-community/mathlib4-nightly-testing:lean-pr-testing-NNNN toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants