Skip to Content.
Sympa Menu

coq-club - [Coq-Club] How do I structure Modules with typeclass contexts?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] How do I structure Modules with typeclass contexts?


Chronological Thread 
  • From: Agnishom Chattopadhyay <agnishom AT cmi.ac.in>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] How do I structure Modules with typeclass contexts?
  • Date: Sat, 6 Jun 2020 13:39:05 -0500
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=agnishom AT cmi.ac.in; spf=Pass smtp.mailfrom=agnishom AT cmi.ac.in; spf=None smtp.helo=postmaster AT mail.cmi.ac.in
  • Ironport-phdr: 9a23:Z5BZ9hTycO1DCzyHuVHOAVtYH9psv+yvbD5Q0YIujvd0So/mwa6yZhKN2/xhgRfzUJnB7Loc0qyK6v2mADBdqs/a6jgrS99lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUhrwOhBoKevrB4Xck9q41/yo+53Ufg5EmCexbal9IRmrrQjdrNQajIRiJ6o+1xfErGVEcPlKyG11Il6egwzy7dqq8p559CRQtfMh98peXqj/Yq81U79WAik4Pm4s/MHkugXNQgWJ5nsHT2UZiQFIDBTf7BH7RZj+rC33vfdg1SaAPM32Sbc0WSm+76puVRTlhjsLOyI//WrKjMF7kaBVrw+7pxFnzIHaYI+bOvljcK3DYdwXXnBOUtpLWiFbHo+wc4kCAuwcNuhYtYn9oF4OoAOiCAmjAuPvyyRIhn/x3a0/zu8sDwHG0xY8H9ISt3TUtM/6O7oSUeG11qbJzSjIYvRM1jfy7ojIcwshofGLXbJ1asfe1UwvFwLfglqKtYPpJTKV1uIUvmWd8uFvWv6hhXQ9pAFtvjig2N0sio/Ri4wb1FzI6Cp0zZopKdO3VkN3fNGqHZRMuyyeN4Z7Qt0uTnx2tCom1rALvZC1cSoExZk7xBPSaOGLfomK7x/tUOucJypzinF9eL+nmhq+7EitxvfiWsS701tGtDRJnsTWunwQ1BHf9tCLRuVh8kqlwzqC1ADe5vtZLU01lKfXMZ4szqI2m5EOq0rMBDX2l1/zjKKOdkUr5Oyo6+P/b7XjvJCcNot0hhviPaQrm8yzG/43PRQUU2ia/+SwzLzj/UvnT7VWlvA6j7TVvZDAKcgFqaO0ABVZ3pg+5xqlEjur08gUkWECLF1feRKHi4bpO0vJIPD9FfqwmVuskDFqx/DdPr3hBZDNI2Pfn7fkfLZx8VRTxxYpwdBe4ZJYEqsBL+7rWk/tqNzYCQc0PBCzw+b+EdlyyoceWX+UDaKCK6PTsVqI5vo1LOWWZY8Vviz9K/k/6PL0g385gwxVQa781pwOLXu8A/5OIkODYHOqjM1SP30Nu18XQ+rrk12FVHZ4Z3+uQ6Uk7z07GYu3RdPKSYasm7yG2Q+wG5wQb2sAC1baQiSgTJmNR/pZMHHaGcRmiDFRDeHwGb9k7gmnsUrB85QiK+PV/iMCspe6jYp+4uyVnBp09DomVp3AgVHIdHl9myYzfxFz3K17phUjmFKK0Kw+iPlZU9VYofJPAF9jaczsitdiAtW3YTrvO8+TQQ//EN6jAHc4RZQwxY1Wbg==

I want to describe some polymorphic operations which depend on typeclasses and organize them in separate files. What is the best way to achieve this?

So, I have a file Monitor.v in which I have the following incantations at the top (Lattice, BoundedLattice, DistributiveLattice are typeclasses defined elsewhere):

```
Variable (Val : Type).
Context {lattice_val : Lattice Val}.
Context {boundedLattice_val : BoundedLattice Val}.
Context {distributiveLattice_val : DistributiveLattice Val}.
```

and below that, there are several things which work properly only if there is a meaningful type Val with all the typeclass constraints.

I want to be able to import the module Monitor.v from inside other files and use the definitions in it. When I do so, I want to instantiate Val and the typeclasses with specific instances. How do I do this? It appears that even though some of the imported things require a specific type be instantiated for Val, there is no way to describe what the relevant instances for the typeclasses are.

My goal here is to be able to extract code for different instantiations of Val and with different typeclasses.

--Agnishom



Archive powered by MHonArc 2.6.19+.

Top of Page