| 1 |
Record foo := |
| 2 |
{ |
| 3 |
myprop : Type; |
| 4 |
}. |
| 5 |
|
| 6 |
Set Primitive Projections. |
| 7 |
|
| 8 |
Record bar := |
| 9 |
{ |
| 10 |
myotherprop : Type ; |
| 11 |
someprop : myotherprop; |
| 12 |
somefn : myotherprop -> myotherprop |
| 13 |
}. |
| 14 |
|
| 15 |
|
| 16 |
Existing Class myprop. |
| 17 |
Existing Class myotherprop. |
| 18 |
|
| 19 |
#[export] Instance : forall O, myprop O. Abort. |
| 20 |
#[export] Instance : forall (O : bar), myotherprop O. |
| 21 |
Proof. |
| 22 |
intros O. destruct O; cbn. exact someprop0. |
| 23 |
Defined. |
| 24 |
|
| 25 |
Definition bar_nat : bar := {| myotherprop := nat; someprop := 0; somefn x := x |}. |
| 26 |
|
| 27 |
Definition overloaded {b : bar} (o : myotherprop b) : myotherprop b := |
| 28 |
somefn _ (someprop _). |
| 29 |
|
| 30 |
Global Instance defaultbar_nat : myotherprop bar_nat := 0. |
| 31 |
|
| 32 |
Type (_ : myotherprop bar_nat). |