-
Notifications
You must be signed in to change notification settings - Fork 107
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
Support nested records in deriveEsqueletoRecord
#324
Support nested records in deriveEsqueletoRecord
#324
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great! just needs a few tests written to ensure it works
src/Database/Esqueleto/Record.hs
Outdated
case filteredInstances of | ||
sqlType : _ -> pure $ Just sqlType | ||
_ -> pure Nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
case filteredInstances of | |
sqlType : _ -> pure $ Just sqlType | |
_ -> pure Nothing | |
pure $ listToMaybe filteredInstances |
-- Filter `instances` to the instances which match `originalType`. | ||
filteredInstances :: [Type] | ||
filteredInstances = | ||
flip mapMaybe instances |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, listToMaybe . mapMaybe f
is also find (isJust . f)
- may be easier or more concise to write like that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, because find
only returns the element but I also need the mapMaybe
part to transform and extract the sql type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, good point!
released as 3.5.6.1 |
Before submitting your PR, check that you've:
@since
declarations to the Haddock.stylish-haskell
and otherwise adhered to the style guide.After submitting your PR: