-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: reduce
s.1 =?= v
to s =?= ⟨v⟩
if structure has a single field
This feature was suggested by @dselsam at PR #521. It closes #509
- Loading branch information
1 parent
94e299a
commit a435f3d
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
class has_note (M : Type) where | ||
note : M | ||
|
||
notation "♩" => has_note.note | ||
|
||
class has_note2 (M : Type) extends has_note M | ||
|
||
variable {ι : Type} (β : ι → Type) | ||
|
||
structure foo [∀ i, has_note (β i)] : Type where | ||
to_fun : ∀ i, β i | ||
|
||
instance foo.has_note [∀ i, has_note (β i)] : has_note (foo (λ i => β i)) where | ||
note := { to_fun := λ _ => ♩ } | ||
|
||
instance foo.has_note2 [∀ i, has_note2 (β i)] : has_note2 (foo (λ i => β i)) where | ||
note := ♩ | ||
|
||
variable (α : Type) (M : Type) | ||
|
||
structure bar [has_note M] where | ||
to_fun : α → M | ||
|
||
instance bar.has_note [has_note M] : has_note (bar α M) where | ||
note := { to_fun := λ _ => ♩ } | ||
|
||
instance bar.has_note2 [has_note2 M] : has_note2 (bar α M) where | ||
note := ♩ | ||
|
||
example [has_note2 M] : has_note2 (foo (λ (i : ι) => bar (β i) M)) := | ||
inferInstance | ||
|
||
example [has_note2 M] : has_note2 (foo (λ (i : ι) => bar (β i) M)) := | ||
foo.has_note2 _ |