Skip to content

Mention GHC generics support in documentation #6

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

Merged
merged 3 commits into from
Feb 7, 2019

Conversation

Gabriella439
Copy link
Contributor

No description provided.

@@ -67,6 +67,20 @@ import GHC.Generics
-- in a single row of the query result. Otherwise, a 'ConversionFailed'
-- exception will be thrown.
--
-- You can also derive 'FromRow' for your data type using GHC generics, like
-- this:
Copy link
Collaborator

Choose a reason for hiding this comment

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

should one mention Product type? Should we add an instance with TypeError for :+:?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@phadej: I think adding new instances is outside of the scope for this pull request (which is just to mention that it even exists)

However, I can update the documentation to mention that it only works for product types and does not support sum types

-- deriving ('GHC.Generics.Generic', 'FromRow')
-- @
--
-- Note that this only works for product types (i.e. records) and does not
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should i.e. be e.g. because data Foo = Foo Int String is a product type, but is not a record.

... as suggested by @phadej
@phadej
Copy link
Collaborator

phadej commented Feb 7, 2019

Thanks!

@phadej phadej merged commit b02bcf7 into haskellari:master Feb 7, 2019
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.

2 participants