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

Module wrapping e-graphs to use custom e-class-ids #23

Open
alt-romes opened this issue Jul 29, 2023 · 0 comments
Open

Module wrapping e-graphs to use custom e-class-ids #23

alt-romes opened this issue Jul 29, 2023 · 0 comments

Comments

@alt-romes
Copy link
Owner

Idea

It is arguably useful to be able to use e-class ids other than ClassId, so we could provide a module that wraps an e-graph and provides an interface to the e-graph in which e-class-ids are some user-defined type that supports lookups (e.g. instances Ord)

  • If we want to associate some data with an e-class, but don't want it to live in the e-class data because it might be used very often, or inherently related to the Id rather than the e-class
  • The user-type for Ids might allow discovering equalities on its own before the e-graph has to, since the Eq instance of the user type might take into consideration more data rather than just being an Int.
  • TODO

This is mostly motivated by the use of e-graphs in GHC's pattern match checker, where it is potentially useful to use Ids as e-class ids.

Alternatives

We could also say we won't do this as it is a bit ad-hoc and adds complexity, and that

  • users can have a datatype wrap ClassId with more data they require, and then still use e-class ids and/or
  • users can instead implement this layer of indirection themselves
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

No branches or pull requests

1 participant