coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Adam Chlipala <adamc AT hcoop.net>
- To: Vincent BENAYOUN <benayoun.vincent AT gmail.com>
- Cc: coq-club AT pauillac.inria.fr
- Subject: Re: [Coq-Club] nat and Datatypes.nat
- Date: Fri, 28 Aug 2009 07:57:08 -0400
- List-archive: <http://pauillac.inria.fr/pipermail/coq-club/>
Vincent BENAYOUN wrote:
Does anyone can explain me the signification of the error I get with the below example ?
Error message : *The term "v" has type "nat" while it is expected to have type
"Datatypes.nat".*
Definition records_convert (r : my_records) :=
match r with
| My_Record nat _ "a" v My_EmptyRecord => Record1 v
| My_Record string _ "b" b (My_Record nat _ "c" c My_EmptyRecord) => Record2 b c
| _ => Match0_other (* I need to be exhaustive *)
end.
You are using [nat] as a pattern variable, so it is bound locally in the first pattern to whatever type appears as the first argument to [My_Record]. It is impossible to pattern-match on types, so you will need to introduce an extra level of syntax and interpretation if you want to write this kind of code.
- [Coq-Club] nat and Datatypes.nat, Vincent BENAYOUN
- Re: [Coq-Club] nat and Datatypes.nat, Adam Chlipala
Archive powered by MhonArc 2.6.16.