packages feed

data-msgpack 0.0.11 → 0.0.12

raw patch · 5 files changed

+2/−248 lines, 5 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.MessagePack: getArray :: Get a -> Get [a]
+ Data.MessagePack: getBin :: Get ByteString
+ Data.MessagePack: getBool :: Get Bool
+ Data.MessagePack: getDouble :: Get Double
+ Data.MessagePack: getExt :: Get (Word8, ByteString)
+ Data.MessagePack: getFloat :: Get Float
+ Data.MessagePack: getInt :: Get Int64
+ Data.MessagePack: getMap :: Get a -> Get b -> Get [(a, b)]
+ Data.MessagePack: getNil :: Get ()
+ Data.MessagePack: getObject :: Get Object
+ Data.MessagePack: getStr :: Get Text
+ Data.MessagePack: getWord :: Get Word64
+ Data.MessagePack: putArray :: (a -> Put) -> [a] -> Put
+ Data.MessagePack: putBin :: ByteString -> Put
+ Data.MessagePack: putBool :: Bool -> Put
+ Data.MessagePack: putDouble :: Double -> Put
+ Data.MessagePack: putExt :: Word8 -> ByteString -> Put
+ Data.MessagePack: putFloat :: Float -> Put
+ Data.MessagePack: putInt :: Int64 -> Put
+ Data.MessagePack: putMap :: (a -> Put) -> (b -> Put) -> [(a, b)] -> Put
+ Data.MessagePack: putNil :: Put
+ Data.MessagePack: putObject :: Object -> Put
+ Data.MessagePack: putStr :: Text -> Put
+ Data.MessagePack: putWord :: Word64 -> Put

Files

data-msgpack.cabal view
@@ -1,5 +1,5 @@ name:                 data-msgpack-version:              0.0.11+version:              0.0.12 synopsis:             A Haskell implementation of MessagePack homepage:             http://msgpack.org/ license:              BSD3@@ -62,8 +62,6 @@   hs-source-dirs: test   main-is: testsuite.hs   other-modules:-      Data.MessagePack.OptionSpec-      Data.MessagePack.ResultSpec       Data.MessagePackSpec   ghc-options:       -Wall
src/Data/MessagePack.hs view
@@ -24,11 +24,10 @@   , module X   ) where -import           Control.Applicative    (Applicative, (<|>))+import           Control.Applicative    (Applicative) import           Control.Monad          ((>=>)) import           Data.Binary            (Binary (..), decodeOrFail, encode) import qualified Data.ByteString.Lazy   as L-import           Prelude                hiding (putStr)  import           Data.MessagePack.Get   as X import           Data.MessagePack.Put   as X
− test/Data/MessagePack/OptionSpec.hs
@@ -1,128 +0,0 @@-{-# LANGUAGE LambdaCase  #-}-{-# LANGUAGE Trustworthy #-}-module Data.MessagePack.OptionSpec where--import           Test.Hspec-import           Test.QuickCheck--import           Control.Applicative           (empty, pure, (<$>), (<*>),-                                                (<|>))-import           Control.Monad                 (mplus, mzero)-import qualified Data.MessagePack.Types.Option as O---newtype F = F (Int -> O.Option Int)--instance Show F where-  show = const "<function>"--instance Arbitrary F where-  arbitrary = F <$> arbitrary----- | Checks that 'O.Option' satisfies the laws described in the 'Monad' and--- 'Applicative' documentation.------ Also see:--- https://wiki.haskell.org/Monad_laws--- https://hackage.haskell.org/package/base-4.9.0.0/docs/Prelude.html#t:Applicative-spec :: Spec-spec = do-  describe "Monad" $ do-    it "satisfies left identity" $-      property $ \a (F f) ->-        (return' a `bind'` f) `shouldBe` f a--    it "satisfies right identity" $-      property $ \m ->-        (m `bind'` return') `shouldBe` m--    it "satisfies associativity" $-      property $ \m (F f) (F g) ->-        ((m `bind'` f) `bind'` g) `shouldBe` (m `bind'` (\x -> f x `bind'` g))--    it "supports 'fail'" $-      fail' "nope" `shouldBe` O.None--  describe "Applicative" $ do-    it "satisfies identity" $-      property identity--    it "satisfies composition" $-      property $ \x y w -> do-        composition  O.None             O.None              w-        composition  O.None            (pure (y *)        ) w-        composition (pure (x *)      )  O.None              w-        composition (pure (x *)      ) (pure (y *)        ) w--    it "satisfies homomorphism" $-      property $ \x -> homomorphism (x *)--    it "satisfies interchange" $-      property $ \x y -> do-        interchange  O.None            y-        interchange (pure (x *)      ) y--  describe "Alternative" $ do-    it "chooses the left-most success" $ do-      O.Some "a" <|> O.Some "b" `shouldBe` O.Some "a"-      O.Some "a" <|> O.None     `shouldBe` O.Some "a"-      O.None     <|> O.Some "b" `shouldBe` O.Some "b"--    it "chooses the right-most failure" $-      O.None        <|> O.None        `shouldBe` (O.None :: O.Option ())--    describe "empty" $-      it "is a failure" $-        empty <|> O.Some "a" `shouldBe` O.Some "a"--  describe "MonadPlus" $ do-    it "chooses the left-most success" $ do-      O.Some "a" `mplus` O.Some "b" `shouldBe` O.Some "a"-      O.Some "a" `mplus` O.None     `shouldBe` O.Some "a"-      O.None     `mplus` O.Some "b" `shouldBe` O.Some "b"--    it "chooses the right-most failure" $-      O.None     `mplus` O.None        `shouldBe` (O.None :: O.Option ())--    describe "mzero" $-      it "is a failure" $-        mzero `mplus` O.Some "a" `shouldBe` O.Some "a"--  where-    ---    -- Aliases constrained to the Option monad. These also help avoid lint-    -- warnings about using monad laws.-    ----    return' :: Int -> O.Option Int-    return' = return--    bind' :: O.Option Int -> (Int -> O.Option Int) -> O.Option Int-    bind' = (>>=)--    fail' :: String -> O.Option Int-    fail' = fail--    pure' :: a -> O.Option a-    pure' = pure--    ---    -- Applicative laws.-    ----    identity :: O.Option Int -> Expectation-    identity v =-      (pure' id <*> v) `shouldBe` v--    composition :: O.Option (Int -> Int) -> O.Option (Int -> Int) -> O.Option Int -> Expectation-    composition u v w =-      (pure' (.) <*> u <*> v <*> w) `shouldBe` (u <*> (v <*> w))--    homomorphism :: (Int -> Int) -> Int -> Expectation-    homomorphism h x =-      (pure' h <*> pure' x) `shouldBe` pure' (h x)--    interchange :: O.Option (Int -> Int) -> Int -> Expectation-    interchange u y =-      (u <*> pure' y) `shouldBe` (pure' ($ y) <*> u)
− test/Data/MessagePack/ResultSpec.hs
@@ -1,114 +0,0 @@-{-# LANGUAGE LambdaCase  #-}-{-# LANGUAGE Trustworthy #-}-module Data.MessagePack.ResultSpec where--import           Test.Hspec-import           Test.QuickCheck--import           Control.Applicative           (empty, pure, (<$>), (<*>),-                                                (<|>))-import qualified Data.MessagePack.Types.Result as R---newtype F = F (Int -> R.Result Int)--instance Show F where-  show = const "<function>"--instance Arbitrary F where-  arbitrary = F <$> arbitrary----- | Checks that 'R.Result' satisfies the laws described in the 'Monad' and--- 'Applicative' documentation.------ Also see:--- https://wiki.haskell.org/Monad_laws--- https://hackage.haskell.org/package/base-4.9.0.0/docs/Prelude.html#t:Applicative-spec :: Spec-spec = do-  describe "Monad" $ do-    it "satisfies left identity" $-      property $ \a (F f) ->-        (return' a `bind'` f) `shouldBe` f a--    it "satisfies right identity" $-      property $ \m ->-        (m `bind'` return') `shouldBe` m--    it "satisfies associativity" $-      property $ \m (F f) (F g) ->-        ((m `bind'` f) `bind'` g) `shouldBe` (m `bind'` (\x -> f x `bind'` g))--    it "supports 'fail'" $-      fail' "nope" `shouldBe` R.Failure "nope"--  describe "Applicative" $ do-    it "satisfies identity" $-      property identity--    it "satisfies composition" $-      property $ \x y w -> do-        composition (R.Failure "nope") (R.Failure "no way") w-        composition (R.Failure "nope") (pure (y *)        ) w-        composition (pure (x *)      ) (R.Failure "no way") w-        composition (pure (x *)      ) (pure (y *)        ) w--    it "satisfies homomorphism" $-      property $ \x -> homomorphism (x *)--    it "satisfies interchange" $-      property $ \x y -> do-        interchange (R.Failure "nope") y-        interchange (pure (x *)      ) y--  describe "Alternative" $ do-    it "chooses the left-most success" $ do-      R.Success "a" <|> R.Success "b" `shouldBe` R.Success "a"-      R.Success "a" <|> R.Failure "b" `shouldBe` R.Success "a"-      R.Failure "a" <|> R.Success "b" `shouldBe` R.Success "b"--    it "chooses the right-most failure" $-      R.Failure "a" <|> R.Failure "b" `shouldBe` (R.Failure "b" :: R.Result ())--    describe "empty" $-      it "is a failure" $-        empty <|> R.Success "a" `shouldBe` R.Success "a"--  where-    ---    -- Aliases constrained to the Result monad. These also help avoid lint-    -- warnings about using monad laws.-    ----    return' :: Int -> R.Result Int-    return' = return--    bind' :: R.Result Int -> (Int -> R.Result Int) -> R.Result Int-    bind' = (>>=)--    fail' :: String -> R.Result Int-    fail' = fail--    pure' :: a -> R.Result a-    pure' = pure--    ---    -- Applicative laws.-    ----    identity :: R.Result Int -> Expectation-    identity v =-      (pure' id <*> v) `shouldBe` v--    composition :: R.Result (Int -> Int) -> R.Result (Int -> Int) -> R.Result Int -> Expectation-    composition u v w =-      (pure' (.) <*> u <*> v <*> w) `shouldBe` (u <*> (v <*> w))--    homomorphism :: (Int -> Int) -> Int -> Expectation-    homomorphism h x =-      (pure' h <*> pure' x) `shouldBe` pure' (h x)--    interchange :: R.Result (Int -> Int) -> Int -> Expectation-    interchange u y =-      (u <*> pure' y) `shouldBe` (pure' ($ y) <*> u)
test/Data/MessagePackSpec.hs view
@@ -1,6 +1,5 @@ {-# OPTIONS_GHC -fno-warn-orphans #-} {-# LANGUAGE DeriveGeneric       #-}-{-# LANGUAGE LambdaCase          #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE Trustworthy         #-} module Data.MessagePackSpec where