packages feed

protocol-buffers 2.1.9 → 2.1.10

raw patch · 3 files changed

+21/−22 lines, 3 files

Files

Text/ProtocolBuffers/Basic.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE DeriveDataTypeable,GeneralizedNewtypeDeriving #-} -- | "Text.ProtocolBuffers.Basic" defines or re-exports most of the -- basic field types; 'Maybe','Bool', 'Double', and 'Float' come from--- the Prelude instead. This module also defined the 'Mergeable' and+-- the Prelude instead. This module also defines the 'Mergeable' and -- 'Default' classes. The 'Wire' class is not defined here to avoid orphans. module Text.ProtocolBuffers.Basic   ( -- * Basic types for protocol buffer fields in Haskell@@ -30,7 +30,7 @@ -- Num instances are derived below for the purpose of getting fromInteger for case matching  -- | 'Utf8' is used to mark 'ByteString' values that (should) contain--- valud utf8 encoded strings.  This type is used to represent+-- valid utf8 encoded strings.  This type is used to represent -- 'TYPE_STRING' values. newtype Utf8 = Utf8 ByteString deriving (Data,Typeable,Eq,Ord) @@ -134,13 +134,13 @@ -- | 'EnumCode' is the Int32 assoicated with a -- EnumValueDescriptorProto and is in the range 0 to 2^31-1. newtype EnumCode = EnumCode { getEnumCode :: Int32 }  -- really [0..maxBound::Int32] of some .proto defined enumeration-  deriving (Eq,Ord,Read,Show,Num,Data,Typeable) +  deriving (Eq,Ord,Read,Show,Num,Data,Typeable)  instance Bounded EnumCode where   minBound = 0-  maxBound = 2147483647 -- 2^-31 -1 +  maxBound = 2147483647 -- 2^-31 -1 --- | 'WireSize' is the Int64 size type associate with the lazy+-- | 'WireSize' is the Int64 size type associated with the lazy -- bytestrings used in the 'Put' and 'Get' monads. type WireSize = Int64 @@ -150,7 +150,7 @@ -- 'mergeConcat' defaults to @foldl@ associativity. -- -- NOTE: 'mergeEmpty' has been removed in protocol buffers version 2.--- Use defaultValue instead.  New strict fields would mean that required+-- Use 'defaultValue' instead.  New strict fields would mean that required -- fields in messages will be automatic errors with 'mergeEmpty'. class Default a => Mergeable a where {-
Text/ProtocolBuffers/Extensions.hs view
@@ -12,7 +12,7 @@ -- 'getVal' and 'isSet'.  These allow uniform access to normal and -- extension fields for users. ----- Access to extension fields is strictly though keys.  There is not+-- Access to extension fields is strictly through keys.  There is not -- currently any way to query or change or clear any other extension -- field data. --@@ -57,7 +57,7 @@ -- The 'Key' type (opaque to the user) has a phantom type of Maybe -- or Seq that corresponds to Optional or Repeated fields. And a -- second phantom type that matches the message type it must be used--- with.  The third type parameter corresonds to the Haskell value+-- with.  The third type parameter corresponds to the Haskell value -- type. -- -- The 'Key' is a GADT that puts all the needed class instances into@@ -121,17 +121,17 @@  -- | The 'PackedSeq' is needed to distinguish the packed repeated format from the repeated format. -- This is only used in the phantom type of Key.-newtype PackedSeq a = PackedSeq { unPackedSeq ::  (Seq a) }+newtype PackedSeq a = PackedSeq { unPackedSeq :: Seq a }   deriving (Typeable) --- | The WireType is used to ensure the Seq is homogenous.+-- | The WireType is used to ensure the Seq is homogeneous. -- The ByteString is the unparsed input after the tag. data ExtFieldValue = ExtFromWire !(Seq EP) -- XXX must store wiretype with ByteString                    | ExtOptional !FieldType !GPDyn                    | ExtRepeated !FieldType !GPDynSeq                    | ExtPacked   !FieldType !GPDynSeq   deriving (Typeable,Ord,Show)-           + -- | For making a Data instance for ExtField data ExtDataPair = ExtDataPair FieldId (Seq EP)   deriving (Typeable,Data,Show)@@ -178,12 +178,11 @@  instance Data ExtField where   gfoldl f z m = z dataFromList `f` dataToList m-  gunfold k z c = case constrIndex c of-                    _ -> k (z dataFromList)+  gunfold k z c = k (z dataFromList)   toConstr (ExtField _) = con_ExtField   dataTypeOf _ = ty_ExtField -  + instance ExtendMessage DummyMessageType where   getExtField = undefined   putExtField = undefined@@ -210,7 +209,7 @@     in case parseWireExtMaybe key wt s' of          Right (_,y) -> x==y          _ -> False-  (==) y@(ExtFromWire {}) x@(ExtOptional {})  = x == y+  (==) y@ExtFromWire {} x@ExtOptional {}  = x == y   (==) x@(ExtRepeated ft (GPDynSeq w)) (ExtFromWire s') =     let wt = toWireType ft         makeKeyType :: Seq a -> Key Seq DummyMessageType a@@ -219,7 +218,7 @@     in case parseWireExtSeq key wt s' of          Right (_,y) -> x==y          _ -> False-  (==) y@(ExtFromWire {}) x@(ExtRepeated {})  = x == y+  (==) y@ExtFromWire {} x@ExtRepeated {}  = x == y   (==) x@(ExtPacked ft (GPDynSeq w)) (ExtFromWire s') =     let wt = 2 -- all packed types have wire type 2, length delimited         makeKeyType :: Seq a -> Key PackedSeq DummyMessageType a@@ -228,7 +227,7 @@     in case parseWireExtPackedSeq key wt s' of          Right (_,y) -> x==y          _ -> False-  (==) y@(ExtFromWire {}) x@(ExtPacked {})  = x == y+  (==) y@ExtFromWire {} x@ExtPacked {}  = x == y   (==) _ _ = False  -- | 'ExtendMessage' abstracts the operations of storing and@@ -246,7 +245,7 @@ wireGetKeyToUnPacked k@(Key i t mv) msg = do   let myCast :: Maybe a -> Get (Seq a)       myCast = undefined-  vv <- wireGetPacked t `asTypeOf` (myCast mv)+  vv <- wireGetPacked t `asTypeOf` myCast mv   let (ExtField ef) = getExtField msg   v' <- case M.lookup i ef of           Nothing -> return $ ExtRepeated t (GPDynSeq vv)@@ -277,7 +276,7 @@   let wt = toWireType t       myCast :: Maybe a -> Get a       myCast = undefined-  v <- wireGet t `asTypeOf` (myCast mv)+  v <- wireGet t `asTypeOf` myCast mv   let (ExtField ef) = getExtField msg   v' <- case M.lookup i ef of           Nothing -> return $ ExtPacked t (GPDynSeq (Seq.singleton v))@@ -450,13 +449,13 @@            case cast d of              Nothing -> Left $ "getExt Maybe: Key's value cast failed: "++show (k,typeOf d)              Just d' -> Right (Just d')-         getExt' (ExtFromWire {}) = err $ "Impossible? getExt.getExt' Maybe should not have ExtFromWire case (after parseWireExt)!"+         getExt' ExtFromWire {} = err "Impossible? getExt.getExt' Maybe should not have ExtFromWire case (after parseWireExt)!"    wireGetKey k@(Key i t mv) msg = do     let wt = toWireType t         myCast :: Maybe a -> Get a         myCast = undefined-    v <- wireGet t `asTypeOf` (myCast mv)+    v <- wireGet t `asTypeOf` myCast mv     let (ExtField ef) = getExtField msg     v' <- case M.lookup i ef of             Nothing -> return $ ExtOptional t (GPDyn v)
protocol-buffers.cabal view
@@ -1,5 +1,5 @@ name:           protocol-buffers-version:        2.1.9+version:        2.1.10 cabal-version:  >= 1.6 build-type:     Simple license:        BSD3