msgpack 0.7.1.2 → 0.7.1.3
raw patch · 3 files changed
+7/−77 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Data/MessagePack/Derive.hs +6/−6
- msgpack.cabal +1/−1
- test/Test.hs +0/−70
Data/MessagePack/Derive.hs view
@@ -23,10 +23,10 @@ derivePack asObject tyName = do info <- reify tyName d <- case info of- TyConI (DataD _ {- cxt -} name tyVars cons _ {- derivings -}) -> do- ds <- [d| from v = $(caseE [| v |] (map alt cons)) |]+ TyConI (DataD _ {- cxt -} name tyVars cons _ {- derivings -}) -> instanceD (cx tyVars) (ct ''Packable name tyVars) $- map return ds+ [ funD 'from [ clause [] (normalB [e| \v -> $(caseE [| v |] (map alt cons)) |]) []]+ ] _ -> error $ "cant derive Packable: " ++ show tyName return [d]@@ -61,10 +61,10 @@ deriveUnpack asObject tyName = do info <- reify tyName d <- case info of- TyConI (DataD _ {- cxt -} name tyVars cons _ {- derivings -}) -> do- ds <- [d| get = $(foldl1 (\x y -> [| $x `mplus` $y |]) $ map alt cons) |]+ TyConI (DataD _ {- cxt -} name tyVars cons _ {- derivings -}) -> instanceD (cx tyVars) (ct ''Unpackable name tyVars) $- map return ds+ [ funD 'get [ clause [] (normalB (foldl1 (\x y -> [| $x `mplus` $y |]) $ map alt cons)) []]+ ] _ -> error $ "cant derive Unpackable: " ++ show tyName return [d]
msgpack.cabal view
@@ -1,5 +1,5 @@ Name: msgpack-Version: 0.7.1.2+Version: 0.7.1.3 Synopsis: A Haskell implementation of MessagePack Description: A Haskell implementation of MessagePack <http://msgpack.org/> Homepage: http://msgpack.org/
− test/Test.hs
@@ -1,70 +0,0 @@-import Test.Framework-import Test.Framework.Providers.QuickCheck2-import Test.QuickCheck--import Control.Monad-import qualified Data.ByteString.Char8 as B-import qualified Data.ByteString.Lazy.Char8 as L-import Data.MessagePack--instance Arbitrary a => Arbitrary (Assoc a) where- arbitrary = liftM Assoc arbitrary--mid :: (Packable a, Unpackable a) => a -> a-mid = unpack . pack--prop_mid_int a = a == mid a- where types = a :: Int-prop_mid_nil a = a == mid a- where types = a :: ()-prop_mid_bool a = a == mid a- where types = a :: Bool-prop_mid_double a = a == mid a- where types = a :: Double-prop_mid_string a = a == mid a- where types = a :: String-prop_mid_bytestring a = B.pack a == mid (B.pack a)- where types = a :: String-prop_mid_lazy_bytestring a = (L.pack a) == mid (L.pack a)- where types = a :: String-prop_mid_array_int a = a == mid a- where types = a :: [Int]-prop_mid_array_string a = a == mid a- where types = a :: [String]-prop_mid_pair2 a = a == mid a- where types = a :: (Int, Int)-prop_mid_pair3 a = a == mid a- where types = a :: (Int, Int, Int)-prop_mid_pair4 a = a == mid a- where types = a :: (Int, Int, Int, Int)-prop_mid_pair5 a = a == mid a- where types = a :: (Int, Int, Int, Int, Int)-prop_mid_list_int_double a = a == mid a- where types = a :: [(Int, Double)]-prop_mid_list_string_string a = a == mid a- where types = a :: [(String, String)]-prop_mid_map_string_int a = a == mid a- where types = a :: Assoc [(String,Int)]--tests =- [ testGroup "simple"- [ testProperty "int" prop_mid_int- , testProperty "nil" prop_mid_nil- , testProperty "bool" prop_mid_bool- , testProperty "double" prop_mid_double- , testProperty "string" prop_mid_string- , testProperty "bytestring" prop_mid_bytestring- , testProperty "lazy-bytestring" prop_mid_lazy_bytestring- , testProperty "[int]" prop_mid_array_int- , testProperty "[string]" prop_mid_array_string- , testProperty "(int, int)" prop_mid_pair2- , testProperty "(int, int, int)" prop_mid_pair3- , testProperty "(int, int, int, int)" prop_mid_pair4- , testProperty "(int, int, int, int, int)" prop_mid_pair5- , testProperty "[(int, double)]" prop_mid_list_int_double- , testProperty "[(string, string)]" prop_mid_list_string_string- , testProperty "Assoc [(string, int)]" prop_mid_map_string_int- ]- ]--main = defaultMain tests