Skip to content

Commit aa5562f

Browse files
committed
address review
1 parent 6b54eee commit aa5562f

1 file changed

Lines changed: 6 additions & 14 deletions

File tree

src/Lean/Data/Html/Basic.lean

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def ofString (escape : Bool) : String → Html :=
4848

4949
instance : Coe String Html := ⟨.text⟩
5050

51-
/-- Append two HTML forests. -/
51+
/-- Appends two HTML forests. -/
5252
def append : Html → Html → Html
5353
| .seq #[], h => h
5454
| h, .seq #[] => h
@@ -59,26 +59,18 @@ def append : Html → Html → Html
5959

6060
instance : 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
6464
Equivalent 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`. -/
8476
instance : ToJson Html where

0 commit comments

Comments
 (0)