Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dotParam widget to control dot notation #6267

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kmill
Copy link
Collaborator

@kmill kmill commented Nov 30, 2024

This PR introduces the dotParam marker to indicate which parameter should be used for generalized field notation ("dot notation"). If a function has a dotParam parameter, then this will be used instead of any other argument. Example application:

class A (α : Type _) where
  a : α → Nat

def A.get {α : Type _} [A α] (self : dotParam α) : Nat := a self

structure B where
  b : Nat

instance : A B := ⟨B.b⟩

namespace B
export A (get)
end B

#check fun (b : B) => b.get
-- b.get : Nat

The pretty printing code is modified to support the export-resolved dot notation introduced in #6189.

Closes #1629, closes #5482

This PR introduces the `dotParam` marker to indicate which parameter should be used for generalized field notation ("dot notation"). Example:
```
class A (α : Type _) where
  a : α → Nat

def A.get {α : Type _} [A α] (self : dotParam α) : Nat := a self

structure B where
  b : Nat

instance : A B := ⟨B.b⟩

namespace B
export A (get)
end B

#check fun (b : B) => b.get
-- b.get : Nat
```
The pretty printing code is modified to support the `export`-resolved dot notation introduced in leanprover#6189.

Closes leanprover#1629, closes leanprover#5482
@kmill kmill added the changelog-language Language features, tactics, and metaprograms label Nov 30, 2024
@kmill kmill marked this pull request as draft November 30, 2024 22:25
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Nov 30, 2024
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase ca96922b4be5d395f6e3102ed3c8950e18982be7 --onto 86f303774a7fbf38406ae13bd4b66f2753643a45. (2024-11-30 22:41:55)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-language Language features, tactics, and metaprograms toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
2 participants