yesodweb / yesodweb/persistent
Problems with BackendCompatible vs BaseBackend
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
I'm attempting to update a codebase with heavy use of SqlReadT and SqlWriteT to latest LTS, which means v2.8.2 of persistent/persistent-postgresql. I'm running into the issue best described and reproduced in this minimal example:
https://gist.github.com/pbrisbin/47ad427ed4c421c21a29fff3a154e448
Here's what I think is happening:
sqlSettingscreates an Entity withSqlBackendrefselectListwantsPersistRecordBackend record backendref- We have
type PersistRecordBackend record backend = (PersistEntity record, PersistEntityBackend record ~ BaseBackend backend)ref - So for this entity, that means
BaseBackend backend ~ SqlBackend SqlReadTno longer provides that, it only providesBackendCompatible SqlBackend backendref ref
So I'm not sure if SqlBackendCanRead needs an update like I have in the gist (which is actually changing it back to what it was before), or PersistRecordBackend needs an update to use BackendCompatible, or if there's something else going on entirely.
If there's anything else about our code that we can change to make this work, that'd be appreciated, but moving from Sql(Read|Write)T to ReaderT backend so we can add these different constraints ourselves would be a very cumbersome upgrade path, so I'd love to avoid that.
Thank you in advance.
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
Compile the minimal example in the linked gist, then trace selectList, PersistRecordBackend, SqlReadT, SqlWriteT, and SqlBackendCanRead in the persistent packages. Determine which compatibility constraint should govern the example and verify the resolution against the reported upgrade path; the issue is done when the minimal reproduction works without requiring a cumbersome migration to ReaderT backend.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell, sql
- Domain
- backend-api-design, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100