-
Notifications
You must be signed in to change notification settings - Fork 297
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
Automatic (TH) PathPiece generation is poorly documented, and confusing #649
Comments
Here is a minimal example. In a separate module, we have: import Database.Persist.TH
data Bug = Ant | Bee | Roach deriving (Show, Read, Eq, Ord)
derivePersistField "Bug" Then our main program has: share [mkPersist sqlSettings] [persistLowerCase|
Foo
bar Bug
Primary idea
|] The compiler will complain with
My problem still stands: I fail to see why these instances are needed, and I feel that the documentation does not address this behaviour of |
Can any of of the maintainers comment on this? |
A perusal of the GitHub search results for PathPiece and http-api-data yielded: I took a look at
For I only see it generating code for the |
We should be able to remove these requirements soon. #990 added a facility to make deriving instances uniformly easy, so we will be able to drop the automatic derivation. This should additionally make the dependency footprint a bit smaller. |
I just encountered this when using |
The documentation for
mkPersist
saysI'm struggling to understand why it also creates
PathPiece
instances. In particular, I have hit a confusing issue where, with more than two tables being defined, using an enum type (whose instances where generated viaderivePersistField
) in the one table causes the compiler to complain that the data type does not have the appropriatepath-pieces
instances, but enums in another table do not cause the same error.The source code for the module reads
What does this even mean?? Note that my project does not use Yesod (yet), so I'm finding it difficult to justify creating
PathPiece
and*HttpApiData
instances just to satisfy the compiler when there aren't any actual paths in the code base, or any other hint of HTTP.On a possibly-related note, declaringbut right now my guesses are worthless.DeriveGeneric
andDeriveAnyClass
as default extensions in my project causesmkPersist
to blow up and start complaining about missingGeneric
instances. That is, I guess this might be a weird extensions issue,If necessary, I can try and create a minimal example producing the issue. But I'm hoping this rings a bell and has been encountered by someone else before.
The text was updated successfully, but these errors were encountered: