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

Cannot turn off PathPiece and ToHttpApiData newtype instances for keys #1458

Open
lf- opened this issue Dec 30, 2022 · 0 comments
Open

Cannot turn off PathPiece and ToHttpApiData newtype instances for keys #1458

lf- opened this issue Dec 30, 2022 · 0 comments

Comments

@lf-
Copy link
Contributor

lf- commented Dec 30, 2022

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).

deriving newtype instance ToHttpApiData (BackendKey $(pure backendT)) => ToHttpApiData (Key $(pure recordType))
deriving newtype instance FromHttpApiData (BackendKey $(pure backendT)) => FromHttpApiData(Key $(pure recordType))
deriving newtype instance PathPiece (BackendKey $(pure backendT)) => PathPiece (Key $(pure recordType))

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