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

Export GFromRow and GToRow for use as constraints #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

carymrobbins
Copy link
Contributor

This is useful for generalizing over things which can have their FromRow and ToRow instances derived. Specifically, this would enable libraries like generic-override to be able to interop with postgresql-simple's generic machinery.


Without this change, given the following code -

instance (Generic (Override a xs)) => ToRow (Override a xs)

We'll get the following compiler error -

Could not deduce (Database.PostgreSQL.Simple.ToRow.GToRow
                          (Data.Override.Internal.OverrideRep
                             Data.Override.Internal.EmptyInspect xs (Rep a)))
        arising from a use of ‘Database.PostgreSQL.Simple.ToRow.$dmtoRow’

This can be easily fixed by adding the GToRow constraint -

instance (Generic (Override a xs), GToRow (Override a xs)) => ToRow (Override a xs)

However, this can't be done unless the constraint itself is exported.

@carymrobbins
Copy link
Contributor Author

Looks like the checks failed only on AppVeyor, which looks to be a linker error.

@phadej - Are you the one to approve/merge this? Would be good to know if this change would be accepted or if there is some alternative you'd like instead.

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.

1 participant