Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Custom record build function

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Custom record build function


Chronological Thread 
  • From: Joachim Breitner <mail AT joachim-breitner.de>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] Custom record build function
  • Date: Tue, 21 Nov 2017 12:22:39 -0500
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=mail AT joachim-breitner.de; spf=Neutral smtp.mailfrom=mail AT joachim-breitner.de; spf=None smtp.helo=postmaster AT hermes.serverama.de
  • Ironport-phdr: 9a23:gZE2JhEwsfxjrLtMUjUpbp1GYnF86YWxBRYc798ds5kLTJ76r8qwAkXT6L1XgUPTWs2DsrQf1LqQ7viocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWf8zMIJRX+KQcwY829WsuL15z2hKiO/MjYZBwNjz6ga5tzKg+3pEPfrJo4m4xnf4Q2wxDJo34AUf5bxH9uKEjbyxP158OY/plq+CRRvrcr7cNBTaP3ZeI0QOoLX3wdL2kp6Ziz5lH4RgyV6y5ZCz1Onw==

Dear all,


if I read the reference manual correctly, then

Definition b := {| x := 5; y := 3 |}.

is just syntactic sugar for

Definition b := Build_point 5 3.

This makes me wonder: Can I register, for a type t that is not defined
using Record, a “build” function and “field names” so that the user can
use record syntax?

For example given

Inductive OptPair a b := pair a b | no_pair.

can I somehow make

Definition c := {| fst := 5; snd := 3 |}.

accepted notation for

Definition c := pair 5 3


Thanks,
Joachim

BTW, the next question will be if that desugaring then works with the

Instance ... := { … }.

notation.


--
Joachim Breitner

mail AT joachim-breitner.de
http://www.joachim-breitner.de/

Attachment: signature.asc
Description: This is a digitally signed message part




Archive powered by MHonArc 2.6.18.

Top of Page