Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add StateT Monad Transformer #952

Open
wants to merge 6 commits into
base: coq-8.16
Choose a base branch
from

Conversation

JasonGross
Copy link
Contributor

No description provided.

@gmalecha
Copy link
Contributor

Is there a reason not to use an existing library?

@JasonGross
Copy link
Contributor Author

What library did you have in mind? (I tend to accidentally reinvent the wheel a bunch.)

@JasonGross
Copy link
Contributor Author

My reason for adding this is to make writing some TemplateMonad code that manages some state on the side a bit easier, in writing automation for proving well-typedness of quotation. It doesn't seem worth it to add another dependency to MetaCoq just for this purpose, unless we want to rip out all the monad utils and replace them with whatever library we'd be using.

@gmalecha
Copy link
Contributor

  • ExtLib has a fairly complete monad library. The itrees work is building on that. I am not certain the status of the theory.
  • stdpp has some as well, but it is smaller.
  • I'm less certain about other things, but MathClasses probably has something.

Writing a good monad library with theory is not easy due to universes (stdpp has some issues with this) and some of the issues that you highlighted in your paper on category theory in Coq. This is the main reason that I think it would useful to not build another library.

@JasonGross
Copy link
Contributor Author

Is the ExtLib library universe polymorphic and cumulative? (It looks like right now it's universe polymorphic but not cumulative, which will break some of the MetaCoq code IIRC.) If so, I'd be happy to have the MetaCoq monad library replaced with that (assuming everyone is on board with adding the dependency), though I don't think I have the time to make the replacement myself.

Note, however, that MetaCoq doesn't need any theory associated with the monad operations, because the library is just for convenient syntax for running template programs, and there's no reasoning that needs to be done about them. Similarly, I'm adding a state monad here so that I can get easy management of state when using the template monad, and don't need any fancy theory.

@mattam82
Copy link
Member

It would be fine to depend on extlib from my viewpoint. This also avoids unintentional universe/notation clashes when using both MetaCoq and extlib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants