leanprover / leanprover/lean4

RFC: show expected type in instance declarations

Open
#6,619 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P-medium RFC
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Proposal

2025-01-12-22-57-22

(This may be more appropriate in the vscode-lean4 repo?)

In the pic above, putting the cursor on toString does not show the expected type, but hovering does. However, for defs that are not instance implementations, putting the cursor on the identifier will show the expected type as in the following picture.

2025-01-12-22-57-38

I propose that it show should the expected type even in instance declarations.

  • User Experience: How does this feature improve the user experience?

Easier to see what a function is doing, and anyway hovering shows that type info.

  • Beneficiaries: Which Lean users and projects benefit most from this feature/change?

New users, people who don't want to keep stuff in their head.

  • Maintainability: Will this change streamline code maintenance or simplify its structure?

Dunno.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the issue's examples and screenshots, then determine whether the behavior belongs in lean4 or vscode-lean4 as suggested. The work is done when placing the cursor on an identifier in an instance declaration shows its expected type, matching the behavior described for non-instance definitions.

Written by the indexing model from the issue text.

Assessment

Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.