Skip to content
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

mkPersist generates unbound type names since 2.14.3.2 #1467

Open
lexi-lambda opened this issue Jan 19, 2023 · 0 comments
Open

mkPersist generates unbound type names since 2.14.3.2 #1467

lexi-lambda opened this issue Jan 19, 2023 · 0 comments

Comments

@lexi-lambda
Copy link

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:

FTTypeCon _ (checkIdSuffix -> Just tableName) <- mft

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant