Commit 816ff170 authored by Ryan Scott's avatar Ryan Scott

Add safecopy-0.10.0 patch

parent 9f89fda3
Pipeline #10158 passed with stages
in 46 minutes and 40 seconds
diff -ru safecopy-0.10.0.orig/src/Data/SafeCopy/Derive.hs safecopy-0.10.0/src/Data/SafeCopy/Derive.hs
--- safecopy-0.10.0.orig/src/Data/SafeCopy/Derive.hs 2019-09-13 13:27:45.000000000 -0400
+++ safecopy-0.10.0/src/Data/SafeCopy/Derive.hs 2019-09-13 17:49:25.307267022 -0400
@@ -259,19 +259,29 @@
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)
+#else
#if MIN_VERSION_template_haskell(2,11,0)
DataInstD context _name ty _kind cons _derivs ->
#else
DataInstD context _name ty cons _derivs ->
#endif
worker' (foldl appT (conT tyName) (map return ty)) context [] (zip [0..] cons)
+#endif
+#if MIN_VERSION_template_haskell(2,15,0)
+ NewtypeInstD context _ nty _kind con _derivs ->
+ worker' (return nty) context [] [(0, con)]
+#else
#if MIN_VERSION_template_haskell(2,11,0)
NewtypeInstD context _name ty _kind con _derivs ->
#else
NewtypeInstD context _name ty con _derivs ->
#endif
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)
@@ -305,6 +315,13 @@
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)
+ | otherwise ->
+ return []
+#else
#if MIN_VERSION_template_haskell(2,11,0)
DataInstD context _name ty _kind cons _derivs
#else
@@ -314,7 +331,15 @@
worker' (foldl appT (conT tyName) (map return ty)) context [] (zip [0..] cons)
| otherwise ->
return []
+#endif
+#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)]
+ | otherwise ->
+ return []
+#else
#if MIN_VERSION_template_haskell(2,11,0)
NewtypeInstD context _name ty _kind con _derivs
#else
@@ -324,6 +349,7 @@
worker' (foldl appT (conT tyName) (map return ty)) context [] [(0, con)]
| otherwise ->
return []
+#endif
_ -> fail $ "Can't derive SafeCopy instance for: " ++ show (tyName, inst)
return $ concat decs
_ -> fail $ "Can't derive SafeCopy instance for: " ++ show (tyName, info)
diff -ru safecopy-0.10.0.orig/src/Data/SafeCopy/SafeCopy.hs safecopy-0.10.0/src/Data/SafeCopy/SafeCopy.hs
--- safecopy-0.10.0.orig/src/Data/SafeCopy/SafeCopy.hs 2019-09-13 13:27:45.000000000 -0400
+++ safecopy-0.10.0/src/Data/SafeCopy/SafeCopy.hs 2019-09-13 17:49:25.307267022 -0400
@@ -551,7 +551,7 @@
checkConsistency :: (SafeCopy a, Monad m) => Proxy a -> m b -> m b
checkConsistency proxy ks
= case consistentFromProxy proxy of
- NotConsistent msg -> fail msg
+ NotConsistent msg -> error msg
Consistent -> ks
{-# INLINE computeConsistency #-}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment