Implement Type Literal based field definitions #1343
Implement Type Literal based field definitions #1343parsonsmatt merged 11 commits intoyesodweb:matt/finalize-type-lit-prfrom
Conversation
persistent/Database/Persist/Types.hs
Outdated
| , FieldCascade(..) | ||
| , FieldDef(..) | ||
| , FieldType(..) | ||
| , FieldTypeLit(..) |
There was a problem hiding this comment.
Given the comment at the top here:
persistent/persistent/Database/Persist/Types.hs
Lines 48 to 50 in 77545dc
I wasn't sure if this was the right place for this import, but seemed like it was where everything else was re-exported (I need to use this type in Persist/TH.hs I think...)
Going forward should I import this from Database.Persist.Types.Base ? Or is re-exporting it here correct for the time being?
There was a problem hiding this comment.
I'd rather not expose data constructors to the end-user in a non Internal module, since any change to those constructors necessitates a breaking change to the API version.
There was a problem hiding this comment.
In this case, I'd be fine exporting it from Database.Persist.Quasi.Internal, since that's where it is used.
| [ Token "one" | ||
| , Token "Finite 1" | ||
| ] | ||
| ) |
There was a problem hiding this comment.
This was an initial test I did as an exploratory thing to verify the parser was even parsing numbers at all to begin with (which it was), this test could potentially be removed now. Though it may also be worthwhile leaving in.
There was a problem hiding this comment.
Yeah! It's good to have around as a regression. Thanks for the test!
8cf0393 to
85e2ee8
Compare
85e2ee8 to
8f46fd8
Compare
parsonsmatt
left a comment
There was a problem hiding this comment.
Thanks! This is great 😂
OK, so, since this is modifying a constructor on an exposed type (FieldType), then it's a major version bump. So it'll go in with persistent-2.14.
| <|> parseParenEnclosed x xs | ||
| <|> parseList x xs | ||
| <|> parseNumericLit x xs | ||
| <|> parseTextLit x xs | ||
| <|> parseTypeCon x xs |
There was a problem hiding this comment.
Nice - this is great. Moving away from ad-hoc text munging and instead using more idiomatic Haskell classes.
persistent/Database/Persist/Types.hs
Outdated
| , FieldCascade(..) | ||
| , FieldDef(..) | ||
| , FieldType(..) | ||
| , FieldTypeLit(..) |
There was a problem hiding this comment.
I'd rather not expose data constructors to the end-user in a non Internal module, since any change to those constructors necessitates a breaking change to the API version.
persistent/Database/Persist/Types.hs
Outdated
| , FieldCascade(..) | ||
| , FieldDef(..) | ||
| , FieldType(..) | ||
| , FieldTypeLit(..) |
There was a problem hiding this comment.
In this case, I'd be fine exporting it from Database.Persist.Quasi.Internal, since that's where it is used.
| [ Token "one" | ||
| , Token "Finite 1" | ||
| ] | ||
| ) |
There was a problem hiding this comment.
Yeah! It's good to have around as a regression. Thanks for the test!
| |] | ||
|
|
||
| spec :: Spec | ||
| spec = describe "TypeLitFieldDefs" $ do |
|
Oh - this also needs a bump/changelog entry for |
929ee46 to
f940172
Compare
cc95228 to
929bc97
Compare
|
hmm, we have a test failure now. would like to get this merged in before 2.14, will try and get it sorted if you can't get to it soon thanks! |
* Implement Type Literal based field definitions (#1343) * Implement typelit field definitions * Some cleanup * Sort indentation and add PR link in changelog * Move location of exposed type Co-authored-by: Matt Parsons <[email protected]> * fix tests Co-authored-by: Dan Brooks <[email protected]>
Implements #562
Before submitting your PR, check that you've:
@sincedeclarations to the Haddockstylish-haskellon any changed files..editorconfigfile for details)After submitting your PR:
(unreleased)on the Changelog