File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ def ofString (escape : Bool) : String → Html :=
4848
4949instance : Coe String Html := ⟨.text⟩
5050
51- /-- Append two HTML forests. -/
51+ /-- Appends two HTML forests. -/
5252def append : Html → Html → Html
5353 | .seq #[], h => h
5454 | h, .seq #[] => h
@@ -59,26 +59,18 @@ def append : Html → Html → Html
5959
6060instance : Append Html := ⟨.append⟩
6161
62- /-- Merges an array of HTML values by appending them.
62+ /-- Merges a collection of HTML values by appending them.
6363
6464Equivalent to {name}`Html.seq`, but may produce a more compact representation. -/
65- def ofArray (hs : Array Html) : Html := Id.run do
65+ @ [suggest_for Lean.Html.ofArray Lean.Html.ofList]
66+ def ofCollection {ρ : Type w} [ForIn Id ρ Html] (hs : ρ) : Html := Id.run do
6667 let mut out := .empty
6768 for h in hs do
6869 out := out ++ h
6970 return out
7071
71- /-- Merges a list of HTML values by appending them.
72-
73- Equivalent to {lean}`Html.seq hs.toArray`, but may produce a more compact representation. -/
74- def ofList (hs : List Html) : Html := Id.run do
75- let mut out := .empty
76- for h in hs do
77- out := out ++ h
78- return out
79-
80- instance : Coe (Array Html) Html := ⟨ofArray⟩
81- instance : Coe (List Html) Html := ⟨ofList⟩
72+ instance : Coe (Array Html) Html := ⟨ofCollection⟩
73+ instance : Coe (List Html) Html := ⟨ofCollection⟩
8274
8375/-- A compact JSON encoding of {name}`Html`. -/
8476instance : ToJson Html where
You can’t perform that action at this time.
0 commit comments