yesodweb / yesodweb/persistent
Cannot turn off PathPiece and ToHttpApiData newtype instances for keys
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
I'm writing a not-a-webapp and I think it's somewhat odd that Persistent will generate deriving newtype instance FromHttpApiData and likewise for PathPiece for all keys, even though this should not be necessary for non-web users; furthermore there is a mechanism in MkPersistSettings to set mpsDeriveInstances to derive more instances, which could be used to achieve this for web users that want it.
I think that the default mkPersistSettings should probably be changed to include these extra instances, such that it can be overridden if they are not desirable. This would unfortunately be a breaking change for those overriding mpsDeriveInstances while discarding the default value (which was previously empty-list).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in persistent/Database/Persist/TH.hs around lines 1748-1750 and inspect how mkPersistSettings populates mpsDeriveInstances. Confirm how the default PathPiece and FromHttpApiData instances are generated and define the configuration behavior that lets non-web users disable them while web users can retain them. Done means the defaults and override behavior match the requested use cases without silently discarding intended derivations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100