Skip to content

Commit b322748

Browse files
committed
make binder types explicit
1 parent 478f0f4 commit b322748

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

templates/contribute/style.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ theorem mem_split {x : T} {l : List T} : x ∈ l → ∃ s t : List T, l = s ++
181181
have H4 : y :: l = (y :: s) ++ (x :: t) := by rw [H3]; rfl
182182
Exists.intro (y :: s) (Exists.intro t H4)))
183183
```
184+
The type of all arguments of a declaration should be given,
185+
even if Lean can figure out this type information by itself.
186+
This makes it easier to understand the definition when seeing it on a webpage like GitHub.
187+
For the same reason, the return type of all declarations should also be given
188+
(Lean enforces this only for theorems).
184189

185190
A short declaration can be written on a single line:
186191
```lean
@@ -325,9 +330,10 @@ lemma zero_le : ∀ n : ℕ, 0 ≤ n
325330

326331
### Binders
327332

328-
Use a space after binders:
333+
Use a space after binders. Also, the binder type should generally be written explicitly,
334+
even if Lean doesn't need this information.
329335
```lean
330-
example : ∀ α : Type, ∀ x : α, ∃ y, y = x :=
336+
example : ∀ α : Type, ∀ x : α, ∃ y : α, y = x :=
331337
fun (α : Type) (x : α) ↦ Exists.intro x rfl
332338
```
333339

@@ -528,7 +534,7 @@ can be accessed by commenting `!bench` on a PR.
528534

529535
Authors should assure that their contributions do not cause significant
530536
performance regressions. In particular, if the PR touches significant components
531-
of the language like adding instances, adding `simp` lemmas, changing imports,
537+
of the language like adding new classes, instances, or `simp` lemmas, changing imports,
532538
or creating new definitions, then authors should benchmark their changes
533539
proactively.
534540

0 commit comments

Comments
 (0)