diff --git a/safecopy.cabal b/safecopy.cabal
--- a/safecopy.cabal
+++ b/safecopy.cabal
@@ -3,7 +3,7 @@
 -- http://www.haskell.org/cabal/release/cabal-latest/doc/users-guide/authors.html#pkg-descr.
 -- The name of the package.
 Name:                safecopy
-Version:             0.10.1
+Version:             0.10.2
 Synopsis:            Binary serialization with version control.
 Description:         An extension to Data.Serialize with built-in version control.
 Homepage:            https://github.com/acid-state/safecopy
@@ -15,7 +15,7 @@
 Build-type:          Simple
 Extra-source-files: CHANGELOG.md
 Cabal-version:       >=1.8
-tested-with:         GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.5, GHC==8.8.1
+tested-with:         GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.5
 
 Source-repository head
   type:          git
diff --git a/src/Data/SafeCopy/Derive.hs b/src/Data/SafeCopy/Derive.hs
--- a/src/Data/SafeCopy/Derive.hs
+++ b/src/Data/SafeCopy/Derive.hs
@@ -242,11 +242,19 @@
     FamilyI _ insts -> do
       decs <- forM insts $ \inst ->
         case inst of
+#if MIN_VERSION_template_haskell(2,15,0)
+          DataInstD context _ nty _kind cons _derivs ->
+              worker' (return nty) context [] (zip [0..] cons)
+
+          NewtypeInstD context _ nty _kind con _derivs ->
+              worker' (return nty) context [] [(0, con)]
+#else
           DataInstD context _name ty _kind cons _derivs ->
               worker' (foldl appT (conT tyName) (map return ty)) context [] (zip [0..] cons)
 
           NewtypeInstD context _name ty _kind con _derivs ->
               worker' (foldl appT (conT tyName) (map return ty)) context [] [(0, con)]
+#endif
           _ -> fail $ "Can't derive SafeCopy instance for: " ++ show (tyName, inst)
       return $ concat decs
     _ -> fail $ "Can't derive SafeCopy instance for: " ++ show (tyName, info)
@@ -276,15 +284,27 @@
     FamilyI _ insts -> do
       decs <- forM insts $ \inst ->
         case inst of
+#if MIN_VERSION_template_haskell(2,15,0)
+          DataInstD context _ nty _kind cons _derivs
+            | nty == foldl AppT (ConT tyName) tyIndex ->
+              worker' (return nty) context [] (zip [0..] cons)
+#else
           DataInstD context _name ty _kind cons _derivs
             | ty == tyIndex ->
               worker' (foldl appT (conT tyName) (map return ty)) context [] (zip [0..] cons)
+#endif
             | otherwise ->
               return []
 
+#if MIN_VERSION_template_haskell(2,15,0)
+          NewtypeInstD context _ nty _kind con _derivs
+            | nty == foldl AppT (ConT tyName) tyIndex ->
+              worker' (return nty) context [] [(0, con)]
+#else
           NewtypeInstD context _name ty _kind con _derivs
             | ty == tyIndex ->
               worker' (foldl appT (conT tyName) (map return ty)) context [] [(0, con)]
+#endif
             | otherwise ->
               return []
           _ -> fail $ "Can't derive SafeCopy instance for: " ++ show (tyName, inst)
