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

Don't discover constrained instances #1329

Merged

Conversation

masaeedu
Copy link
Contributor

@masaeedu masaeedu commented Oct 13, 2021

The big idea here is that if a user or something besides Database.Persist.TH writes a C a => PersistEntity (Foo a) instance, we don't want discoverEntities to find it and include a entityDef (Proxy :: Proxy (Foo a)) in the list, because there's no way that's going to work (unless C is a trivial typeclass).


Before submitting your PR, check that you've:

  • Documented new APIs with Haddock
    markup
  • Added @since
    declarations

    to the Haddock
  • Ran stylish-haskell on any changed files.
  • Adhered to the code style (see the .editorconfig file for details)

After submitting your PR:

  • Update the Changelog.md file with a link to your PR
  • Bumped the version number if there isn't an (unreleased) on the Changelog
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts)

Copy link
Collaborator

@parsonsmatt parsonsmatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's call this a patch version bump. There's no way this would have worked out previously, so the behavior change is strictly going to allow more programs to work successfully than otherwise. Do you mind adding the changelog entry and cabal file bumps?

@@ -3104,7 +3104,7 @@ discoverEntities = do
mapMaybe getDecType instances
getDecType dec =
case dec of
InstanceD _moverlap _cxt typ _decs ->
InstanceD _moverlap [] typ _decs ->
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this kicks ass thanks!

@masaeedu
Copy link
Contributor Author

masaeedu commented Oct 13, 2021

Do you mind adding the changelog entry and cabal file bumps?

Not at all, just gotta learn how to do that. brb

EDIT: ok, does that look right?

@parsonsmatt parsonsmatt merged commit 34c8b8f into yesodweb:master Oct 13, 2021
@parsonsmatt
Copy link
Collaborator

released as persistent-2.13.2.1

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.

None yet

2 participants