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

Data.Parameterized.TH.GADT: Offer a helper for automating EqF instances #175

Open
RyanGlScott opened this issue Feb 25, 2025 · 0 comments
Open

Comments

@RyanGlScott
Copy link
Contributor

Data.Parameterized.TH.GADT currently offers structuralTypeEquality, which automates the generation of TestEquality instances, but it does not yet offer a counterpart for generating EqF instances. The closest thing that currently exists is structuralEquality, but this is unsuitable for EqF instances in general because it is implemented as isJust (... testEquality ...) under the hood. This means that you can end up with instances that look like instance TestEquality f => EqF (T f), which uses a stronger instance context than what is necessary.

We should offer a variant of structuralEquality which generates code that gives rise to instance Eq f => EqF (T f) instead.

RyanGlScott added a commit to GaloisInc/crucible that referenced this issue Feb 25, 2025
There are many more `EqF` instances that we _could_ define in `crucible`, but
defining them all would likely require coming up with a solution for
GaloisInc/parameterized-utils#175 first. Until then, this patch adds an `EqF`
instance for `TypeRepr` in particular, which is straightforward to define
without any additional functionality and addresses the needs of a downstream
project.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant