protobuf 0.2.1.0 → 0.2.1.1
raw patch · 7 files changed
+17/−14 lines, 7 filesdep +base-orphans
Dependencies added: base-orphans
Files
- CHANGELOG +4/−0
- protobuf.cabal +2/−1
- src/Data/ProtocolBuffers.hs +1/−1
- src/Data/ProtocolBuffers/Decode.hs +2/−2
- src/Data/ProtocolBuffers/Encode.hs +1/−1
- src/Data/ProtocolBuffers/Orphans.hs +2/−9
- tests/Main.hs +5/−0
CHANGELOG view
@@ -1,3 +1,7 @@+0.2.1.1:+ - Fix #26: Import orphan Foldable Last instance from base-orphans+ - Fix #27: Fix failure when decoding empty [packed] fields+ 0.2.1.0: - Fix #17: Repeated n (Enumeration a) difficulty
protobuf.cabal view
@@ -1,5 +1,5 @@ name: protobuf-version: 0.2.1.0+version: 0.2.1.1 synopsis: Google Protocol Buffers via GHC.Generics description: Google Protocol Buffers via GHC.Generics.@@ -46,6 +46,7 @@ Data.ProtocolBuffers.Wire build-depends: base >= 4.7 && < 5,+ base-orphans >= 0.5, bytestring >= 0.9, cereal >= 0.3, data-binary-ieee754 >= 0.4,
src/Data/ProtocolBuffers.hs view
@@ -6,7 +6,7 @@ -- and Google's reference implementation can be found at <http://code.google.com/p/protobuf/>. -- -- It is intended to be used via "GHC.Generics" and does not require @ .proto @ files to function.--- Tools are being developed that will convert a Haskell Protobuf definition into a @ .proto @ and vise versa.+-- Tools are being developed that will convert a Haskell Protobuf definition into a @ .proto @ and vice versa. -- -- Given a message definition: --
src/Data/ProtocolBuffers/Decode.hs view
@@ -46,7 +46,7 @@ Nothing -> return msg -- |--- Decode a Protocol Buffers message prefixed with a varint encoded 32-bit integer describing it's length.+-- Decode a Protocol Buffers message prefixed with a varint encoded 32-bit integer describing its length. decodeLengthPrefixedMessage :: Decode a => Get a {-# INLINE decodeLengthPrefixedMessage #-} decodeLengthPrefixedMessage = do@@ -120,7 +120,7 @@ gdecode msg = fieldDecode Required msg instance (DecodeWire (PackedList a), KnownNat n) => GDecode (K1 i (Packed n a)) where- gdecode msg = fieldDecode PackedField msg+ gdecode msg = fieldDecode PackedField msg <|> pure (K1 mempty) instance GDecode U1 where gdecode _ = return U1
src/Data/ProtocolBuffers/Encode.hs view
@@ -31,7 +31,7 @@ encodeMessage = encode -- |--- Encode a Protocol Buffers message prefixed with a varint encoded 32-bit integer describing it's length.+-- Encode a Protocol Buffers message prefixed with a varint encoded 32-bit integer describing its length. encodeLengthPrefixedMessage :: Encode a => a -> Put {-# INLINE encodeLengthPrefixedMessage #-} encodeLengthPrefixedMessage msg = do
src/Data/ProtocolBuffers/Orphans.hs view
@@ -1,7 +1,3 @@-{-# LANGUAGE DeriveFoldable #-}-{-# LANGUAGE StandaloneDeriving #-}-{-# OPTIONS_GHC -fno-warn-orphans #-}- -- | -- Messages containing 'Optional' 'Enumeration' fields fail to encode. -- This module contains orphan instances required to make these functional.@@ -9,9 +5,6 @@ -- For more information reference the associated ticket: -- <https://github.com/alphaHeavy/protobuf/issues/3> -module Data.ProtocolBuffers.Orphans (Foldable) where--import Data.Foldable (Foldable)-import Data.Monoid (Last(..))+module Data.ProtocolBuffers.Orphans () where -deriving instance Foldable Last+import Data.Orphans ()
tests/Main.hs view
@@ -68,6 +68,7 @@ , testCase "Google Reference Test2" test2 , testCase "Google Reference Test3" test3 , testCase "Google Reference Test4" test4+ , testCase "Packed empty fields" test4_empty , testCase "Optional Enum Test5: Nothing" test5 , testCase "Optional Enum Test5: Just Test5A" test6 , testCase "Optional Enum Test5: Just Test5B" test7@@ -450,6 +451,10 @@ test4 :: Assertion test4 = testSpecific msg =<< unhex "2206038e029ea705" where msg = Test4{test4_d = putField [3,270,86942]}++test4_empty :: Assertion+test4_empty = testSpecific msg =<< unhex "" where+ msg = Test4{test4_d = putField mempty} data Test5Enum = Test5A | Test5B deriving (Eq, Show, Enum) data Test5 = Test5{test5_e :: Optional 5 (Enumeration Test5Enum)} deriving (Generic, Eq, Show)