persistent-template-2.7.2.patch 2.39 KB
Newer Older
1 2 3 4
diff -ru persistent-template-2.7.2.orig/Database/Persist/TH.hs persistent-template-2.7.2/Database/Persist/TH.hs
--- persistent-template-2.7.2.orig/Database/Persist/TH.hs	2019-07-17 09:42:19.000000000 -0400
+++ persistent-template-2.7.2/Database/Persist/TH.hs	2019-07-27 09:12:53.021835613 -0400
@@ -518,8 +518,14 @@
5 6 7 8 9 10 11 12 13 14 15 16 17
 
 uniqueTypeDec :: MkPersistSettings -> EntityDef -> Dec
 uniqueTypeDec mps t =
-    DataInstD [] ''Unique
+    DataInstD []
+#if MIN_VERSION_template_haskell(2,15,0)
+        Nothing
+        (ConT ''Unique `AppT` genericDataType mps (entityHaskell t) backendT)
+#else
+        ''Unique
         [genericDataType mps (entityHaskell t) backendT]
+#endif
             Nothing
18 19
             (map (mkUnique mps t) $ entityUniques t)
             (derivClause $ entityUniques t)
20
@@ -781,7 +787,12 @@
21 22 23 24 25 26 27 28 29 30 31 32 33
                         bi <- backendKeyI
                         return (bi, allInstances)
 
-#if MIN_VERSION_template_haskell(2,12,0)
+#if MIN_VERSION_template_haskell(2,15,0)
+    cxti <- mapM conT i
+    let kd = if useNewtype
+               then NewtypeInstD [] Nothing (ConT k `AppT` recordType) Nothing dec [DerivClause Nothing cxti]
+               else DataInstD    [] Nothing (ConT k `AppT` recordType) Nothing [dec] [DerivClause Nothing cxti]
+#elif MIN_VERSION_template_haskell(2,12,0)
     cxti <- mapM conT i
     let kd = if useNewtype
                then NewtypeInstD [] k [recordType] Nothing dec [DerivClause Nothing cxti]
34
@@ -1068,19 +1079,34 @@
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
         , puk
         , DataInstD
             []
+#if MIN_VERSION_template_haskell(2,15,0)
+            Nothing
+            (ConT ''EntityField `AppT`
+             genDataType `AppT`
+             (VarT $ mkName "typ"))
+#else
             ''EntityField
             [ genDataType
             , VarT $ mkName "typ"
             ]
+#endif
             Nothing
             (map fst fields)
             []
         , FunD 'persistFieldDef (map snd fields)
+#if MIN_VERSION_template_haskell(2,15,0)
+        , TySynInstD
+            (TySynEqn
+               Nothing
+               (ConT ''PersistEntityBackend `AppT` genDataType)
+               (backendDataType mps))
+#else
         , TySynInstD
             ''PersistEntityBackend
62 63 64
             (TySynEqn
                [genDataType]
                (backendDataType mps))
65 66 67 68
+#endif
         , FunD 'persistIdField [normalClause [] (ConE $ keyIdName t)]
         , FunD 'fieldLens lensClauses
         ]