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

Generate ToMaybe in deriveEsqueletoRecord #378

Conversation

halogenandtoast
Copy link
Contributor

replaces #370

After submitting your PR:

  • Update the Changelog.md file with a link to your PR.
  • Check that CI passes (or if it fails, for reasons unrelated to your change, like CI timeouts).

@halogenandtoast halogenandtoast force-pushed the goose/dux-1281-tomaybe-instance-for-deriveesqueletorecord branch from d348f6d to e88a28e Compare September 21, 2023 04:45
@halogenandtoast halogenandtoast marked this pull request as ready for review October 3, 2023 21:35
@halogenandtoast
Copy link
Contributor Author

Opening this up for conversation since the draft didn't get eyes and I think this is nearly there.

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.

Could you write a test that shows it correctly working with Nothing values? ie where the DB gives us NULL back?

@@ -8,25 +8,34 @@
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE OverloadedRecordDot #-}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We probably need to gate this behind CPP for the GHC version since we support GHC that doesn't have this feature yet

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assume gating the whole file makes sense here?

@halogenandtoast halogenandtoast force-pushed the goose/dux-1281-tomaybe-instance-for-deriveesqueletorecord branch from 587a6d4 to bed5a2c Compare October 5, 2023 10:02
@halogenandtoast halogenandtoast force-pushed the goose/dux-1281-tomaybe-instance-for-deriveesqueletorecord branch from bed5a2c to be6fee2 Compare October 5, 2023 10:03
@halogenandtoast
Copy link
Contributor Author

@halogenandtoast
Copy link
Contributor Author

halogenandtoast commented Oct 5, 2023

Confirmed this compiles and all existing tests run and pass on 8.10.7

Comment on lines 348 to 351
#else
it "is only supported in GHC 9.2 or above" $ \_ -> do
pending
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

The feature is supported in GHC <9.2, but you do need to use getField @"blah" explicitly instead of (.blah). So we need to gate use of OverloadedRecordDot behind CPP to support older GHC, but not the entire feature/tests.

Actually, it is probably easier to just getField directly? Then there's no CPP necessary

@halogenandtoast
Copy link
Contributor Author

I don't have a machine I can run 8.6.5 on until November 4th so fixing this will have to wait until then unless someone else can do the update here.

@parsonsmatt parsonsmatt merged commit a69ce68 into bitemyapp:master Oct 24, 2023
7 checks passed
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.

3 participants