From 8dad9e516816d77d34b1d00e2079382eea68aac8 Mon Sep 17 00:00:00 2001 From: Jesse Kempf Date: Mon, 25 Nov 2019 18:13:08 -0800 Subject: [PATCH] Derive Generic instances for non-generic newtype keys --- persistent-template/ChangeLog.md | 4 ++++ persistent-template/Database/Persist/TH.hs | 2 +- persistent-template/persistent-template.cabal | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/persistent-template/ChangeLog.md b/persistent-template/ChangeLog.md index 2dfb3922b..6468faeae 100644 --- a/persistent-template/ChangeLog.md +++ b/persistent-template/ChangeLog.md @@ -1,5 +1,9 @@ ## Unreleased changes +## 2.7.4 + +* Also derive `Generic` instances for non-generic newtype keys (https://github.com/yesodweb/persistent/pull/990 + ## 2.7.3 * Update module documentation for `Database.Persist.TH` to better describe the purpose of the module [#968](https://github.com/yesodweb/persistent/pull/968) diff --git a/persistent-template/Database/Persist/TH.hs b/persistent-template/Database/Persist/TH.hs index 8d11970fb..cc01dba1a 100644 --- a/persistent-template/Database/Persist/TH.hs +++ b/persistent-template/Database/Persist/TH.hs @@ -799,7 +799,7 @@ mkKeyTypeDec mps t = do then do pfDec <- pfInstD return (pfDec, [''Show, ''Read, ''Eq, ''Ord, ''Generic]) else do - let allInstances = [''Show, ''Read, ''Eq, ''Ord, ''PathPiece, ''ToHttpApiData, ''FromHttpApiData, ''PersistField, ''PersistFieldSql, ''ToJSON, ''FromJSON] + let allInstances = [''Show, ''Read, ''Eq, ''Ord, ''PathPiece, ''ToHttpApiData, ''FromHttpApiData, ''PersistField, ''PersistFieldSql, ''ToJSON, ''FromJSON, ''Generic] if customKeyType then return ([], allInstances) else do diff --git a/persistent-template/persistent-template.cabal b/persistent-template/persistent-template.cabal index 247282436..a8e9441e3 100644 --- a/persistent-template/persistent-template.cabal +++ b/persistent-template/persistent-template.cabal @@ -1,5 +1,5 @@ name: persistent-template -version: 2.7.3 +version: 2.7.4 license: MIT license-file: LICENSE author: Michael Snoyman