| 1 |
Class Decodable (A : Type) := decode : nat -> option A. |
| 2 |
Class ContainsType := { SomeType : Type; }. |
| 3 |
|
| 4 |
Section ASection. |
| 5 |
Context `{ContainsType}. |
| 6 |
|
| 7 |
Inductive Wrap := |
| 8 |
| wrap : SomeType -> Wrap. |
| 9 |
|
| 10 |
Axiom any : forall {A}, A. |
| 11 |
Global Instance inst : Decodable Wrap := any. |
| 12 |
End ASection. |
| 13 |
|
| 14 |
Instance impl : ContainsType := |
| 15 |
{| SomeType := nat; |}. |
| 16 |
|
| 17 |
(* |
| 18 |
Error: Cannot infer the 1st argument of the inductive type (@Wrap) of this term (no type |
| 19 |
class instance found) in environment: |
| 20 |
n : nat |
| 21 |
*) |
| 22 |
Definition foo n := |
| 23 |
match decode n with |
| 24 |
| Some (wrap _) => 0 |
| 25 |
| _ => 0 |
| 26 |
end. |