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

Wrong Eq Assignment instance #18

Open
lukemaurer opened this issue Jan 8, 2019 · 2 comments
Open

Wrong Eq Assignment instance #18

lukemaurer opened this issue Jan 8, 2019 · 2 comments

Comments

@lukemaurer
Copy link
Contributor

In Data.Parameterized.Context.Unsafe, Assignment gets the instance

instance TestEquality f => Eq (Assignment f ctx) where
  x == y = isJust (testEquality x y)

The constraint TestEquality f is stronger than necessary. This is especially painful if a type containing an Assignment can't implement TestEquality, as it now can't use the derived Eq instance.

The fix isn't hard, but it will break code where people didn't bother declaring instances of both Eq and TestEquality (which should of course be easy to fix).

@robdockins
Copy link
Contributor

What situation do you have where the f parameter doesn't have TestEquality?

@lukemaurer
Copy link
Contributor Author

A domain for use with Crucible's fixpoint analysis. The type of domTop means the domain type can't carry a TypeRepr. This is the only way it's actually a problem, though, since you never really need to get a TypeRepr for an arbitrary domain value.

It's also worth considering whether fewer types should be schlepping around a TypeRepr as it is. They can take up a surprising amount of memory if you're not careful about sharing.

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

2 participants