yesodweb / yesodweb/persistent
mkPersist generates unbound type names since 2.14.3.2
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 486
- Forks
- 306
- PR merge metrics
- No merged PRs in 30d
Description
There was a bug in #1446 that can result in mkPersist generating unbound type names. Tweaking the following test case very slightly reproduces the issue:
diff --git a/persistent/test/Database/Persist/TH/PersistWithSpec.hs b/persistent/test/Database/Persist/TH/PersistWithSpec.hs
index 25c9fff0..e006f65e 100644
--- a/persistent/test/Database/Persist/TH/PersistWithSpec.hs
+++ b/persistent/test/Database/Persist/TH/PersistWithSpec.hs
@@ -17,7 +17,7 @@ module Database.Persist.TH.PersistWithSpec where
import Control.Monad
import TemplateTestImports
-import Database.Persist.TH.PersistWith.Model as Model (IceCream, IceCreamId)
+import qualified Database.Persist.TH.PersistWith.Model as Model (IceCream, IceCreamId)
import Language.Haskell.TH as TH
mkPersistWith sqlSettings $(discoverEntities) [persistLowerCase|
The root issue is here:
The first field of FTTypeCon can be a module prefix, but this code discards it, which results in unqualified references being generated in the output.
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 the referenced line, then reproduce the issue by applying the qualified import change in persistent/test/Database/Persist/TH/PersistWithSpec.hs. Confirm that mkPersist no longer emits unbound type names and that the affected test passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100