| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Text.ProtocolBuffers
Description
Text.ProtocolBuffers exposes the client API. This merely re-exports parts of the other modules in protocol-buffers. The exposed parts are:
import Text.ProtocolBuffers.Basic ( Seq,isValidUTF8,toUtf8,utf8,Utf8(Utf8),Int32,Int64,Word32,Word64 , WireTag,FieldId,WireType,FieldType,EnumCode,WireSize , Mergeable(mergeAppend,mergeConcat),Default(defaultValue)) import Text.ProtocolBuffers.Extensions ( Key,ExtKey(getExt,putExt,clearExt),MessageAPI(getVal,isSet) , getKeyFieldId,getKeyFieldType,getKeyDefaultValue) import Text.ProtocolBuffers.Identifiers import Text.ProtocolBuffers.Reflections ( ReflectDescriptor(..),ReflectEnum(..),ProtoName(..),HsDefault(..),EnumInfoApp , KeyInfo,FieldInfo(..),DescriptorInfo(..),EnumInfo(..),ProtoInfo(..),makePNF ) import Text.ProtocolBuffers.TextMessage ( messagePutText, messageGetText ) import Text.ProtocolBuffers.WireMessage ( Wire,Put,Get,runPut,runGet,runGetOnLazy , messageSize,messagePut,messageGet,messagePutM,messageGetM , messageWithLengthSize,messageWithLengthPut,messageWithLengthGet,messageWithLengthPutM,messageWithLengthGetM , messageAsFieldSize,messageAsFieldPutM,messageAsFieldGetM)
The message serialization is taken care of by WireMessage
operations, especially messagePut and messageGet. The
MessageAPI provides the useful polymorphic getVal and isSet
where getVal looks up default values and also works with extension
keys. The Utf8 newtype is used to indicate the format in the
underlying lazy ByteString. Messages and values can be combined
with the right-biased Mergeable operations. The mergeEmpty should
not be used as required values are filled in with undefined errors,
please use defaultValue instead.
The Utf8 type is a newtype of the Lazy ByteString. It can be safely
constructed by checking for errors with toUtf8, which returns 'Left
Int' indicating the index where an error is detected. It can be
deconstructed with utf8.
Synopsis
- data Int32
- data Int64
- data Word32
- data Word64
- data Seq a
- class Default a where
- class Default a => Mergeable a where
- type WireSize = Int64
- data EnumCode
- data FieldType
- data WireType
- data FieldId
- data WireTag
- newtype Utf8 = Utf8 ByteString
- utf8 :: Utf8 -> ByteString
- isValidUTF8 :: ByteString -> Maybe Int
- toUtf8 :: ByteString -> Either Int Utf8
- class MessageAPI msg a b | msg a -> b where
- class ExtKey c where
- data Key c msg v
- getKeyFieldId :: Key c msg v -> FieldId
- getKeyFieldType :: Key c msg v -> FieldType
- getKeyDefaultValue :: Key c msg v -> v
- module Text.ProtocolBuffers.Identifiers
- class ReflectDescriptor m where
- class ReflectEnum e where
- type EnumInfoApp e = [(EnumCode, String, e)]
- data EnumInfo = EnumInfo {
- enumName :: ProtoName
- enumFilePath :: [FilePath]
- enumValues :: [(EnumCode, String)]
- data HsDefault
- data FieldInfo = FieldInfo {
- fieldName :: ProtoFName
- fieldNumber :: FieldId
- wireTag :: WireTag
- packedTag :: Maybe (WireTag, WireTag)
- wireTagLength :: WireSize
- isPacked :: Bool
- isRequired :: Bool
- canRepeat :: Bool
- mightPack :: Bool
- typeCode :: FieldType
- typeName :: Maybe ProtoName
- hsRawDefault :: Maybe ByteString
- hsDefault :: Maybe HsDefault
- type KeyInfo = (ProtoName, FieldInfo)
- data DescriptorInfo = DescriptorInfo {}
- data ProtoInfo = ProtoInfo {
- protoMod :: ProtoName
- protoFilePath :: [FilePath]
- protoSource :: FilePath
- extensionKeys :: Seq KeyInfo
- messages :: [DescriptorInfo]
- enums :: [EnumInfo]
- oneofs :: [OneofInfo]
- knownKeyMap :: Map ProtoName (Seq FieldInfo)
- data ProtoName = ProtoName {
- protobufName :: FIName Utf8
- haskellPrefix :: [MName String]
- parentModule :: [MName String]
- baseName :: MName String
- makePNF :: ByteString -> [String] -> [String] -> String -> ProtoName
- messagePutText :: TextMsg a => a -> String
- messageGetText :: (TextMsg a, Stream s Identity Char) => s -> Either String a
- runPut :: Put -> ByteString
- type Put = PutM ()
- data Get a
- runGet :: Get a -> ByteString -> Result a
- class Wire b
- messageSize :: (ReflectDescriptor msg, Wire msg) => msg -> WireSize
- messageWithLengthSize :: (ReflectDescriptor msg, Wire msg) => msg -> WireSize
- messageAsFieldSize :: (ReflectDescriptor msg, Wire msg) => FieldId -> msg -> WireSize
- messagePut :: (ReflectDescriptor msg, Wire msg) => msg -> ByteString
- messageWithLengthPut :: (ReflectDescriptor msg, Wire msg) => msg -> ByteString
- messagePutM :: (ReflectDescriptor msg, Wire msg) => msg -> Put
- messageWithLengthPutM :: (ReflectDescriptor msg, Wire msg) => msg -> Put
- messageAsFieldPutM :: (ReflectDescriptor msg, Wire msg) => FieldId -> msg -> Put
- messageGet :: (ReflectDescriptor msg, Wire msg) => ByteString -> Either String (msg, ByteString)
- messageWithLengthGet :: (ReflectDescriptor msg, Wire msg) => ByteString -> Either String (msg, ByteString)
- messageGetM :: (ReflectDescriptor msg, Wire msg) => Get msg
- messageWithLengthGetM :: (ReflectDescriptor msg, Wire msg) => Get msg
- messageAsFieldGetM :: (ReflectDescriptor msg, Wire msg) => Get (FieldId, msg)
- runGetOnLazy :: Get r -> ByteString -> Either String (r, ByteString)
Documentation
32-bit signed integer type
Instances
| Bounded Int32 | Since: base-2.1 |
| Enum Int32 | Since: base-2.1 |
| Eq Int32 | Since: base-2.1 |
| Integral Int32 | Since: base-2.1 |
| Data Int32 | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Int32 -> c Int32 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Int32 # dataTypeOf :: Int32 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Int32) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int32) # gmapT :: (forall b. Data b => b -> b) -> Int32 -> Int32 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int32 -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int32 -> r # gmapQ :: (forall d. Data d => d -> u) -> Int32 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Int32 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Int32 -> m Int32 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Int32 -> m Int32 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Int32 -> m Int32 # | |
| Num Int32 | Since: base-2.1 |
| Ord Int32 | Since: base-2.1 |
| Read Int32 | Since: base-2.1 |
| Real Int32 | Since: base-2.1 |
Defined in GHC.Int Methods toRational :: Int32 -> Rational # | |
| Show Int32 | Since: base-2.1 |
| Ix Int32 | Since: base-2.1 |
| PrintfArg Int32 | Since: base-2.1 |
Defined in Text.Printf | |
| Storable Int32 | Since: base-2.1 |
| Bits Int32 | Since: base-2.1 |
Defined in GHC.Int Methods (.&.) :: Int32 -> Int32 -> Int32 # (.|.) :: Int32 -> Int32 -> Int32 # xor :: Int32 -> Int32 -> Int32 # complement :: Int32 -> Int32 # shift :: Int32 -> Int -> Int32 # rotate :: Int32 -> Int -> Int32 # setBit :: Int32 -> Int -> Int32 # clearBit :: Int32 -> Int -> Int32 # complementBit :: Int32 -> Int -> Int32 # testBit :: Int32 -> Int -> Bool # bitSizeMaybe :: Int32 -> Maybe Int # shiftL :: Int32 -> Int -> Int32 # unsafeShiftL :: Int32 -> Int -> Int32 # shiftR :: Int32 -> Int -> Int32 # unsafeShiftR :: Int32 -> Int -> Int32 # rotateL :: Int32 -> Int -> Int32 # | |
| FiniteBits Int32 | Since: base-4.6.0.0 |
Defined in GHC.Int Methods finiteBitSize :: Int32 -> Int # countLeadingZeros :: Int32 -> Int # countTrailingZeros :: Int32 -> Int # | |
| Default Int32 # | |
Defined in Text.ProtocolBuffers.Basic Methods defaultValue :: Int32 # | |
| Mergeable Int32 # | |
Defined in Text.ProtocolBuffers.Basic | |
| TextType Int32 # | |
| Wire Int32 # | |
| GPB Int32 # | |
Defined in Text.ProtocolBuffers.Extensions | |
| IArray UArray Int32 | |
Defined in Data.Array.Base Methods bounds :: Ix i => UArray i Int32 -> (i, i) # numElements :: Ix i => UArray i Int32 -> Int unsafeArray :: Ix i => (i, i) -> [(Int, Int32)] -> UArray i Int32 unsafeAt :: Ix i => UArray i Int32 -> Int -> Int32 unsafeReplace :: Ix i => UArray i Int32 -> [(Int, Int32)] -> UArray i Int32 unsafeAccum :: Ix i => (Int32 -> e' -> Int32) -> UArray i Int32 -> [(Int, e')] -> UArray i Int32 unsafeAccumArray :: Ix i => (Int32 -> e' -> Int32) -> Int32 -> (i, i) -> [(Int, e')] -> UArray i Int32 | |
| MessageAPI msg (msg -> Int32) Int32 # | |
| MArray (STUArray s) Int32 (ST s) | |
Defined in Data.Array.Base Methods getBounds :: Ix i => STUArray s i Int32 -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Int32 -> ST s Int newArray :: Ix i => (i, i) -> Int32 -> ST s (STUArray s i Int32) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int32) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int32) unsafeRead :: Ix i => STUArray s i Int32 -> Int -> ST s Int32 unsafeWrite :: Ix i => STUArray s i Int32 -> Int -> Int32 -> ST s () | |
64-bit signed integer type
Instances
| Bounded Int64 | Since: base-2.1 |
| Enum Int64 | Since: base-2.1 |
| Eq Int64 | Since: base-2.1 |
| Integral Int64 | Since: base-2.1 |
| Data Int64 | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Int64 -> c Int64 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Int64 # dataTypeOf :: Int64 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Int64) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Int64) # gmapT :: (forall b. Data b => b -> b) -> Int64 -> Int64 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Int64 -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Int64 -> r # gmapQ :: (forall d. Data d => d -> u) -> Int64 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Int64 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Int64 -> m Int64 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Int64 -> m Int64 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Int64 -> m Int64 # | |
| Num Int64 | Since: base-2.1 |
| Ord Int64 | Since: base-2.1 |
| Read Int64 | Since: base-2.1 |
| Real Int64 | Since: base-2.1 |
Defined in GHC.Int Methods toRational :: Int64 -> Rational # | |
| Show Int64 | Since: base-2.1 |
| Ix Int64 | Since: base-2.1 |
| PrintfArg Int64 | Since: base-2.1 |
Defined in Text.Printf | |
| Storable Int64 | Since: base-2.1 |
| Bits Int64 | Since: base-2.1 |
Defined in GHC.Int Methods (.&.) :: Int64 -> Int64 -> Int64 # (.|.) :: Int64 -> Int64 -> Int64 # xor :: Int64 -> Int64 -> Int64 # complement :: Int64 -> Int64 # shift :: Int64 -> Int -> Int64 # rotate :: Int64 -> Int -> Int64 # setBit :: Int64 -> Int -> Int64 # clearBit :: Int64 -> Int -> Int64 # complementBit :: Int64 -> Int -> Int64 # testBit :: Int64 -> Int -> Bool # bitSizeMaybe :: Int64 -> Maybe Int # shiftL :: Int64 -> Int -> Int64 # unsafeShiftL :: Int64 -> Int -> Int64 # shiftR :: Int64 -> Int -> Int64 # unsafeShiftR :: Int64 -> Int -> Int64 # rotateL :: Int64 -> Int -> Int64 # | |
| FiniteBits Int64 | Since: base-4.6.0.0 |
Defined in GHC.Int Methods finiteBitSize :: Int64 -> Int # countLeadingZeros :: Int64 -> Int # countTrailingZeros :: Int64 -> Int # | |
| Default Int64 # | |
Defined in Text.ProtocolBuffers.Basic Methods defaultValue :: Int64 # | |
| Mergeable Int64 # | |
Defined in Text.ProtocolBuffers.Basic | |
| TextType Int64 # | |
| Wire Int64 # | |
| GPB Int64 # | |
Defined in Text.ProtocolBuffers.Extensions | |
| IArray UArray Int64 | |
Defined in Data.Array.Base Methods bounds :: Ix i => UArray i Int64 -> (i, i) # numElements :: Ix i => UArray i Int64 -> Int unsafeArray :: Ix i => (i, i) -> [(Int, Int64)] -> UArray i Int64 unsafeAt :: Ix i => UArray i Int64 -> Int -> Int64 unsafeReplace :: Ix i => UArray i Int64 -> [(Int, Int64)] -> UArray i Int64 unsafeAccum :: Ix i => (Int64 -> e' -> Int64) -> UArray i Int64 -> [(Int, e')] -> UArray i Int64 unsafeAccumArray :: Ix i => (Int64 -> e' -> Int64) -> Int64 -> (i, i) -> [(Int, e')] -> UArray i Int64 | |
| MessageAPI msg (msg -> Int64) Int64 # | |
| MArray (STUArray s) Int64 (ST s) | |
Defined in Data.Array.Base Methods getBounds :: Ix i => STUArray s i Int64 -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Int64 -> ST s Int newArray :: Ix i => (i, i) -> Int64 -> ST s (STUArray s i Int64) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int64) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Int64) unsafeRead :: Ix i => STUArray s i Int64 -> Int -> ST s Int64 unsafeWrite :: Ix i => STUArray s i Int64 -> Int -> Int64 -> ST s () | |
32-bit unsigned integer type
Instances
| Bounded Word32 | Since: base-2.1 |
| Enum Word32 | Since: base-2.1 |
Defined in GHC.Word | |
| Eq Word32 | Since: base-2.1 |
| Integral Word32 | Since: base-2.1 |
| Data Word32 | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word32 -> c Word32 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word32 # toConstr :: Word32 -> Constr # dataTypeOf :: Word32 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word32) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word32) # gmapT :: (forall b. Data b => b -> b) -> Word32 -> Word32 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word32 -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word32 -> r # gmapQ :: (forall d. Data d => d -> u) -> Word32 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word32 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word32 -> m Word32 # | |
| Num Word32 | Since: base-2.1 |
| Ord Word32 | Since: base-2.1 |
| Read Word32 | Since: base-2.1 |
| Real Word32 | Since: base-2.1 |
Defined in GHC.Word Methods toRational :: Word32 -> Rational # | |
| Show Word32 | Since: base-2.1 |
| Ix Word32 | Since: base-2.1 |
| PrintfArg Word32 | Since: base-2.1 |
Defined in Text.Printf | |
| Storable Word32 | Since: base-2.1 |
| Bits Word32 | Since: base-2.1 |
Defined in GHC.Word Methods (.&.) :: Word32 -> Word32 -> Word32 # (.|.) :: Word32 -> Word32 -> Word32 # xor :: Word32 -> Word32 -> Word32 # complement :: Word32 -> Word32 # shift :: Word32 -> Int -> Word32 # rotate :: Word32 -> Int -> Word32 # setBit :: Word32 -> Int -> Word32 # clearBit :: Word32 -> Int -> Word32 # complementBit :: Word32 -> Int -> Word32 # testBit :: Word32 -> Int -> Bool # bitSizeMaybe :: Word32 -> Maybe Int # shiftL :: Word32 -> Int -> Word32 # unsafeShiftL :: Word32 -> Int -> Word32 # shiftR :: Word32 -> Int -> Word32 # unsafeShiftR :: Word32 -> Int -> Word32 # rotateL :: Word32 -> Int -> Word32 # | |
| FiniteBits Word32 | Since: base-4.6.0.0 |
Defined in GHC.Word Methods finiteBitSize :: Word32 -> Int # countLeadingZeros :: Word32 -> Int # countTrailingZeros :: Word32 -> Int # | |
| Default Word32 # | |
Defined in Text.ProtocolBuffers.Basic Methods defaultValue :: Word32 # | |
| Mergeable Word32 # | |
Defined in Text.ProtocolBuffers.Basic | |
| TextType Word32 # | |
| Wire Word32 # | |
| GPB Word32 # | |
Defined in Text.ProtocolBuffers.Extensions | |
| IArray UArray Word32 | |
Defined in Data.Array.Base Methods bounds :: Ix i => UArray i Word32 -> (i, i) # numElements :: Ix i => UArray i Word32 -> Int unsafeArray :: Ix i => (i, i) -> [(Int, Word32)] -> UArray i Word32 unsafeAt :: Ix i => UArray i Word32 -> Int -> Word32 unsafeReplace :: Ix i => UArray i Word32 -> [(Int, Word32)] -> UArray i Word32 unsafeAccum :: Ix i => (Word32 -> e' -> Word32) -> UArray i Word32 -> [(Int, e')] -> UArray i Word32 unsafeAccumArray :: Ix i => (Word32 -> e' -> Word32) -> Word32 -> (i, i) -> [(Int, e')] -> UArray i Word32 | |
| MessageAPI msg (msg -> Word32) Word32 # | |
| MArray (STUArray s) Word32 (ST s) | |
Defined in Data.Array.Base Methods getBounds :: Ix i => STUArray s i Word32 -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Word32 -> ST s Int newArray :: Ix i => (i, i) -> Word32 -> ST s (STUArray s i Word32) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word32) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word32) unsafeRead :: Ix i => STUArray s i Word32 -> Int -> ST s Word32 unsafeWrite :: Ix i => STUArray s i Word32 -> Int -> Word32 -> ST s () | |
64-bit unsigned integer type
Instances
| Bounded Word64 | Since: base-2.1 |
| Enum Word64 | Since: base-2.1 |
Defined in GHC.Word | |
| Eq Word64 | Since: base-2.1 |
| Integral Word64 | Since: base-2.1 |
| Data Word64 | Since: base-4.0.0.0 |
Defined in Data.Data Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word64 -> c Word64 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word64 # toConstr :: Word64 -> Constr # dataTypeOf :: Word64 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word64) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word64) # gmapT :: (forall b. Data b => b -> b) -> Word64 -> Word64 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word64 -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word64 -> r # gmapQ :: (forall d. Data d => d -> u) -> Word64 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Word64 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word64 -> m Word64 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word64 -> m Word64 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word64 -> m Word64 # | |
| Num Word64 | Since: base-2.1 |
| Ord Word64 | Since: base-2.1 |
| Read Word64 | Since: base-2.1 |
| Real Word64 | Since: base-2.1 |
Defined in GHC.Word Methods toRational :: Word64 -> Rational # | |
| Show Word64 | Since: base-2.1 |
| Ix Word64 | Since: base-2.1 |
| PrintfArg Word64 | Since: base-2.1 |
Defined in Text.Printf | |
| Storable Word64 | Since: base-2.1 |
| Bits Word64 | Since: base-2.1 |
Defined in GHC.Word Methods (.&.) :: Word64 -> Word64 -> Word64 # (.|.) :: Word64 -> Word64 -> Word64 # xor :: Word64 -> Word64 -> Word64 # complement :: Word64 -> Word64 # shift :: Word64 -> Int -> Word64 # rotate :: Word64 -> Int -> Word64 # setBit :: Word64 -> Int -> Word64 # clearBit :: Word64 -> Int -> Word64 # complementBit :: Word64 -> Int -> Word64 # testBit :: Word64 -> Int -> Bool # bitSizeMaybe :: Word64 -> Maybe Int # shiftL :: Word64 -> Int -> Word64 # unsafeShiftL :: Word64 -> Int -> Word64 # shiftR :: Word64 -> Int -> Word64 # unsafeShiftR :: Word64 -> Int -> Word64 # rotateL :: Word64 -> Int -> Word64 # | |
| FiniteBits Word64 | Since: base-4.6.0.0 |
Defined in GHC.Word Methods finiteBitSize :: Word64 -> Int # countLeadingZeros :: Word64 -> Int # countTrailingZeros :: Word64 -> Int # | |
| Default Word64 # | |
Defined in Text.ProtocolBuffers.Basic Methods defaultValue :: Word64 # | |
| Mergeable Word64 # | |
Defined in Text.ProtocolBuffers.Basic | |
| TextType Word64 # | |
| Wire Word64 # | |
| GPB Word64 # | |
Defined in Text.ProtocolBuffers.Extensions | |
| IArray UArray Word64 | |
Defined in Data.Array.Base Methods bounds :: Ix i => UArray i Word64 -> (i, i) # numElements :: Ix i => UArray i Word64 -> Int unsafeArray :: Ix i => (i, i) -> [(Int, Word64)] -> UArray i Word64 unsafeAt :: Ix i => UArray i Word64 -> Int -> Word64 unsafeReplace :: Ix i => UArray i Word64 -> [(Int, Word64)] -> UArray i Word64 unsafeAccum :: Ix i => (Word64 -> e' -> Word64) -> UArray i Word64 -> [(Int, e')] -> UArray i Word64 unsafeAccumArray :: Ix i => (Word64 -> e' -> Word64) -> Word64 -> (i, i) -> [(Int, e')] -> UArray i Word64 | |
| MessageAPI msg (msg -> Word64) Word64 # | |
| MArray (STUArray s) Word64 (ST s) | |
Defined in Data.Array.Base Methods getBounds :: Ix i => STUArray s i Word64 -> ST s (i, i) # getNumElements :: Ix i => STUArray s i Word64 -> ST s Int newArray :: Ix i => (i, i) -> Word64 -> ST s (STUArray s i Word64) # newArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word64) # unsafeNewArray_ :: Ix i => (i, i) -> ST s (STUArray s i Word64) unsafeRead :: Ix i => STUArray s i Word64 -> Int -> ST s Word64 unsafeWrite :: Ix i => STUArray s i Word64 -> Int -> Word64 -> ST s () | |
General-purpose finite sequences.
Instances
| Monad Seq | |
| Functor Seq | |
| MonadFix Seq | Since: containers-0.5.11 |
Defined in Data.Sequence.Internal | |
| Applicative Seq | Since: containers-0.5.4 |
| Foldable Seq | |
Defined in Data.Sequence.Internal Methods fold :: Monoid m => Seq m -> m # foldMap :: Monoid m => (a -> m) -> Seq a -> m # foldr :: (a -> b -> b) -> b -> Seq a -> b # foldr' :: (a -> b -> b) -> b -> Seq a -> b # foldl :: (b -> a -> b) -> b -> Seq a -> b # foldl' :: (b -> a -> b) -> b -> Seq a -> b # foldr1 :: (a -> a -> a) -> Seq a -> a # foldl1 :: (a -> a -> a) -> Seq a -> a # elem :: Eq a => a -> Seq a -> Bool # maximum :: Ord a => Seq a -> a # | |
| Traversable Seq | |
| Eq1 Seq | Since: containers-0.5.9 |
| Ord1 Seq | Since: containers-0.5.9 |
Defined in Data.Sequence.Internal | |
| Read1 Seq | Since: containers-0.5.9 |
Defined in Data.Sequence.Internal | |
| Show1 Seq | Since: containers-0.5.9 |
| MonadZip Seq |
|
| Alternative Seq | Since: containers-0.5.4 |
| MonadPlus Seq | |
| UnzipWith Seq | |
Defined in Data.Sequence.Internal Methods unzipWith' :: (x -> (a, b)) -> Seq x -> (Seq a, Seq b) | |
| ExtKey Seq # | |
| MessageAPI msg (msg -> Seq a) (Seq a) # | |
| Default v => MessageAPI msg (Key Seq msg v) (Seq v) # | |
| IsList (Seq a) | |
| Eq a => Eq (Seq a) | |
| Data a => Data (Seq a) | |
Defined in Data.Sequence.Internal Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Seq a -> c (Seq a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Seq a) # dataTypeOf :: Seq a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Seq a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Seq a)) # gmapT :: (forall b. Data b => b -> b) -> Seq a -> Seq a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Seq a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Seq a -> r # gmapQ :: (forall d. Data d => d -> u) -> Seq a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Seq a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Seq a -> m (Seq a) # | |
| Ord a => Ord (Seq a) | |
| Read a => Read (Seq a) | |
| Show a => Show (Seq a) | |
| a ~ Char => IsString (Seq a) | Since: containers-0.5.7 |
Defined in Data.Sequence.Internal Methods fromString :: String -> Seq a # | |
| Semigroup (Seq a) | Since: containers-0.5.7 |
| Monoid (Seq a) | |
| NFData a => NFData (Seq a) | |
Defined in Data.Sequence.Internal | |
| Default (Seq a) # | |
Defined in Text.ProtocolBuffers.Basic Methods defaultValue :: Seq a # | |
| Mergeable (Seq a) # | |
Defined in Text.ProtocolBuffers.Basic | |
| TextType a => TextType (Seq a) # | |
| type Item (Seq a) | |
Defined in Data.Sequence.Internal | |
The Default class has the default-default values of types. See
http://code.google.com/apis/protocolbuffers/docs/proto.html#optional
and also note that Enum types have a defaultValue that is the
first one in the .proto file (there is always at least one
value). Instances of this for messages hold any default value
defined in the .proto file. defaultValue is where the
MessageAPI function getVal looks when an optional field is not
set.
Minimal complete definition
Methods
defaultValue :: a #
The defaultValue is never undefined or an error to evalute.
This makes it much more useful compared to mergeEmpty. In a
default message all Optional field values are set to Nothing
and Repeated field values are empty.
Instances
class Default a => Mergeable a where #
The Mergeable class is not a Monoid, mergeEmpty is not a
left or right unit like mempty. The default mergeAppend is to
take the second parameter and discard the first one. The
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
fields in messages will be automatic errors with mergeEmpty.
Methods
mergeAppend :: a -> a -> a #
mergeAppend is the right-biased merge of two values. A
message (or group) is merged recursively. Required field are
always taken from the second message. Optional field values are
taken from the most defined message or the second message if
both are set. Repeated fields have the sequences concatenated.
Note that strings and bytes are NOT concatenated.
mergeConcat :: Foldable t => t a -> a #
mergeConcat is F.foldl mergeAppend defaultValue and this
default definition is not overridden in any of the code except
for the (Seq a) instance.
Instances
WireSize is the Int64 size type associated with the lazy
bytestrings used in the Put and Get monads.
EnumCode is the Int32 assoicated with a
EnumValueDescriptorProto and is in the range 0 to 2^31-1.
Instances
| Bounded EnumCode # | |
| Eq EnumCode # | |
| Data EnumCode # | |
Defined in Text.ProtocolBuffers.Basic Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> EnumCode -> c EnumCode # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c EnumCode # toConstr :: EnumCode -> Constr # dataTypeOf :: EnumCode -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c EnumCode) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EnumCode) # gmapT :: (forall b. Data b => b -> b) -> EnumCode -> EnumCode # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EnumCode -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EnumCode -> r # gmapQ :: (forall d. Data d => d -> u) -> EnumCode -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> EnumCode -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> EnumCode -> m EnumCode # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> EnumCode -> m EnumCode # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> EnumCode -> m EnumCode # | |
| Num EnumCode # | |
| Ord EnumCode # | |
Defined in Text.ProtocolBuffers.Basic | |
| Read EnumCode # | |
| Show EnumCode # | |
FieldType is the integer associated with the
FieldDescriptorProto's Type. The allowed range is currently 1 to
18, as shown below (excerpt from descritor.proto)
// 0 is reserved for errors.
// Order is weird for historical reasons.
TYPE_DOUBLE = 1;
TYPE_FLOAT = 2;
TYPE_INT64 = 3; // Not ZigZag encoded. Negative numbers
// take 10 bytes. Use TYPE_SINT64 if negative
// values are likely.
TYPE_UINT64 = 4;
TYPE_INT32 = 5; // Not ZigZag encoded. Negative numbers
// take 10 bytes. Use TYPE_SINT32 if negative
// values are likely.
TYPE_FIXED64 = 6;
TYPE_FIXED32 = 7;
TYPE_BOOL = 8;
TYPE_STRING = 9;
TYPE_GROUP = 10; // Tag-delimited aggregate.
TYPE_MESSAGE = 11; // Length-delimited aggregate.
// New in version 2.
TYPE_BYTES = 12;
TYPE_UINT32 = 13;
TYPE_ENUM = 14;
TYPE_SFIXED32 = 15;
TYPE_SFIXED64 = 16;
TYPE_SINT32 = 17; // Uses ZigZag encoding.
TYPE_SINT64 = 18; // Uses ZigZag encoding.Instances
| Bounded FieldType # | |
| Enum FieldType # | |
Defined in Text.ProtocolBuffers.Basic Methods succ :: FieldType -> FieldType # pred :: FieldType -> FieldType # fromEnum :: FieldType -> Int # enumFrom :: FieldType -> [FieldType] # enumFromThen :: FieldType -> FieldType -> [FieldType] # enumFromTo :: FieldType -> FieldType -> [FieldType] # enumFromThenTo :: FieldType -> FieldType -> FieldType -> [FieldType] # | |
| Eq FieldType # | |
| Data FieldType # | |
Defined in Text.ProtocolBuffers.Basic Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FieldType -> c FieldType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FieldType # toConstr :: FieldType -> Constr # dataTypeOf :: FieldType -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FieldType) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FieldType) # gmapT :: (forall b. Data b => b -> b) -> FieldType -> FieldType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FieldType -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FieldType -> r # gmapQ :: (forall d. Data d => d -> u) -> FieldType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> FieldType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> FieldType -> m FieldType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FieldType -> m FieldType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FieldType -> m FieldType # | |
| Num FieldType # | |
Defined in Text.ProtocolBuffers.Basic | |
| Ord FieldType # | |
| Read FieldType # | |
| Show FieldType # | |
WireType is the 3 bit wire encoding value, and is currently in
the range 0 to 5, leaving 6 and 7 currently invalid.
- 0 Varint : int32, int64, uint32, uint64, sint32, sint64, bool, enum
- 1 64-bit : fixed64, sfixed64, double
- 2 Length-delimited : string, bytes, embedded messages
- 3 Start group : groups (deprecated)
- 4 End group : groups (deprecated)
- 5 32-bit : fixed32, sfixed32, float
Instances
| Bounded WireType # | |
| Enum WireType # | |
Defined in Text.ProtocolBuffers.Basic | |
| Eq WireType # | |
| Data WireType # | |
Defined in Text.ProtocolBuffers.Basic Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WireType -> c WireType # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c WireType # toConstr :: WireType -> Constr # dataTypeOf :: WireType -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c WireType) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WireType) # gmapT :: (forall b. Data b => b -> b) -> WireType -> WireType # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WireType -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WireType -> r # gmapQ :: (forall d. Data d => d -> u) -> WireType -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> WireType -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> WireType -> m WireType # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WireType -> m WireType # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WireType -> m WireType # | |
| Num WireType # | |
| Ord WireType # | |
Defined in Text.ProtocolBuffers.Basic | |
| Read WireType # | |
| Show WireType # | |
FieldId is the field number which can be in the range 1 to
2^29-1 but the value from 19000 to 19999 are forbidden (so sayeth
Google).
Instances
| Bounded FieldId # | |
| Enum FieldId # | |
| Eq FieldId # | |
| Data FieldId # | |
Defined in Text.ProtocolBuffers.Basic Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FieldId -> c FieldId # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FieldId # toConstr :: FieldId -> Constr # dataTypeOf :: FieldId -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FieldId) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FieldId) # gmapT :: (forall b. Data b => b -> b) -> FieldId -> FieldId # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FieldId -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FieldId -> r # gmapQ :: (forall d. Data d => d -> u) -> FieldId -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> FieldId -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> FieldId -> m FieldId # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FieldId -> m FieldId # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FieldId -> m FieldId # | |
| Num FieldId # | |
| Ord FieldId # | |
Defined in Text.ProtocolBuffers.Basic | |
| Read FieldId # | |
| Show FieldId # | |
| Ix FieldId # | |
Defined in Text.ProtocolBuffers.Basic | |
WireTag is the 32 bit value with the upper 29 bits being the
FieldId and the lower 3 bits being the WireType
Instances
Utf8 is used to mark ByteString values that (should) contain
valid utf8 encoded strings. This type is used to represent
TYPE_STRING values.
Constructors
| Utf8 ByteString |
Instances
| Eq Utf8 # | |
| Data Utf8 # | |
Defined in Text.ProtocolBuffers.Basic Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Utf8 -> c Utf8 # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Utf8 # dataTypeOf :: Utf8 -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Utf8) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Utf8) # gmapT :: (forall b. Data b => b -> b) -> Utf8 -> Utf8 # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Utf8 -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Utf8 -> r # gmapQ :: (forall d. Data d => d -> u) -> Utf8 -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Utf8 -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Utf8 -> m Utf8 # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Utf8 -> m Utf8 # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Utf8 -> m Utf8 # | |
| Ord Utf8 # | |
| Read Utf8 # | |
| Show Utf8 # | |
| Semigroup Utf8 # | |
| Monoid Utf8 # | |
| Default Utf8 # | |
Defined in Text.ProtocolBuffers.Basic Methods defaultValue :: Utf8 # | |
| Mergeable Utf8 # | |
Defined in Text.ProtocolBuffers.Basic | |
| Dotted Utf8 # | |
| TextType Utf8 # | |
| Wire Utf8 # | |
| GPB Utf8 # | |
Defined in Text.ProtocolBuffers.Extensions | |
| MessageAPI msg (msg -> Utf8) Utf8 # | |
| Mangle (FIName Utf8) (PFName String) # | |
| Mangle (FIName Utf8) (PMName String) # | |
| Mangle (DIName Utf8) (PFName String) # | |
| Mangle (DIName Utf8) (PMName String) # | |
| Mangle (IName Utf8) (FName String) # | |
| Mangle (IName Utf8) (MName String) # | |
utf8 :: Utf8 -> ByteString #
isValidUTF8 :: ByteString -> Maybe Int #
class MessageAPI msg a b | msg a -> b where #
Minimal complete definition
Methods
Access data in a message. The first argument is always the message. The second argument can be one of 4 categories.
- The field name of a required field acts a simple retrieval of the data from the message.
- The field name of an optional field will retreive the data if it is set or lookup the default value if it is not set.
- The field name of a repeated field always retrieves the
(possibly empty)
Seqof values. - A Key for an optional or repeated value will act as the field name does above, but if there is a type mismatch or parse error it will use the defaultValue for optional types and an empty sequence for repeated types.
Check whether data is present in the message.
- Required fields always return
True. - Optional fields return whether a value is present.
- Repeated field return
Falseif there are no values, otherwise they returnTrue. - Keys return as optional or repeated, but checks only if the field # is present. This assumes that there are no collisions where more that one key refers to the same field number of this message type.
Instances
| MessageAPI msg (msg -> Word64) Word64 # | |
| MessageAPI msg (msg -> Word32) Word32 # | |
| MessageAPI msg (msg -> Int64) Int64 # | |
| MessageAPI msg (msg -> Int32) Int32 # | |
| MessageAPI msg (msg -> Float) Float # | |
| MessageAPI msg (msg -> Double) Double # | |
| MessageAPI msg (msg -> Utf8) Utf8 # | |
| MessageAPI msg (msg -> ByteString) ByteString # | |
Defined in Text.ProtocolBuffers.Extensions Methods getVal :: msg -> (msg -> ByteString) -> ByteString # isSet :: msg -> (msg -> ByteString) -> Bool # | |
| (Default msg, Default a) => MessageAPI msg (msg -> Maybe a) a # | |
| MessageAPI msg (msg -> Seq a) (Seq a) # | |
| Default v => MessageAPI msg (Key Maybe msg v) v # | |
| Default v => MessageAPI msg (Key Seq msg v) (Seq v) # | |
The ExtKey class has three functions for user of the API:
putExt, getExt, and clearExt. The wireGetKey is used in
generated code.
There are two instances of this class, Maybe for optional message
fields and Seq for repeated message fields. This class allows
for uniform treatment of these two kinds of extension fields.
Minimal complete definition
Methods
putExt :: Key c msg v -> c v -> msg -> msg #
Change or clear the value of a key in a message. Passing
Nothing with an optional key or an empty Seq with a repeated
key clears the value. This function thus maintains the invariant
that having a field number in the ExtField map means that the
field is set and not empty.
This should be only way to set the contents of a extension field.
getExt :: Key c msg v -> msg -> Either String (c v) #
Access the key in the message. Optional have type (Key Maybe
msg v) and return type (Maybe v) while repeated fields have
type (Key Seq msg v) and return type (Seq v).
There are a few sources of errors with the lookup of the key:
- It may find unparsed bytes from loading the message.
getExtwill attempt to parse the bytes as the key's value type, and may fail. The parsing is done with theparseWireExtmethod (which is not exported to user API). - The wrong optional-key versus repeated-key type is a failure
- The wrong type of the value might be found in the map and
- cause a failure
The failures above should only happen if two different keys are used with the same field number.
The Key data type is used with the ExtKey class to put, get,
and clear external fields of messages. The Key can also be used
with the MessagesAPI to get a possibly default value and to check
whether a key has been set in a message.
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 corresponds to the Haskell value
type.
The Key is a GADT that puts all the needed class instances into
scope. The actual content is the FieldId ( numeric key), the
FieldType (for sanity checks), and Maybe v (a non-standard
default value).
When code is generated all of the known keys are taken into account in the deserialization from the wire. Unknown extension fields are read as a collection of raw byte sequences. If a key is then presented it will be used to parse the bytes.
There is no guarantee for what happens if two Keys disagree about
the type of a field; in particular there may be undefined values
and runtime errors. The data constructor for Key has to be
exported to the generated code, but is not exposed to the user by
Text.ProtocolBuffers.
getKeyFieldId :: Key c msg v -> FieldId #
This allows reflection, in this case it gives the numerical
FieldId of the key, from 1 to 2^29-1 (excluding 19,000 through
19,999).
getKeyFieldType :: Key c msg v -> FieldType #
This allows reflection, in this case it gives the FieldType
enumeration value (1 to 18) of the
Text.DescriptorProtos.FieldDescriptorProto.Type of the field.
getKeyDefaultValue :: Key c msg v -> v #
This will return the default value for a given Key, which is
set in the '.proto' file, or if unset it is the defaultValue of
that type.
class ReflectDescriptor m where #
Minimal complete definition
Methods
getMessageInfo :: m -> GetMessageInfo #
This is obtained via read on the stored show output of the DescriptorInfo in
the module file. It is used in getting messages from the wire.
Must not inspect argument
Arguments
| :: m | |
| -> DescriptorInfo | Must not inspect argument |
class ReflectEnum e where #
Minimal complete definition
Methods
reflectEnum :: EnumInfoApp e #
Arguments
| :: e | |
| -> EnumInfo | Must not inspect argument |
Arguments
| :: e | |
| -> Maybe DescriptorInfo | Must not inspect argument |
type EnumInfoApp e = [(EnumCode, String, e)] #
Constructors
| EnumInfo | |
Fields
| |
Instances
| Eq EnumInfo # | |
| Data EnumInfo # | |
Defined in Text.ProtocolBuffers.Reflections Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> EnumInfo -> c EnumInfo # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c EnumInfo # toConstr :: EnumInfo -> Constr # dataTypeOf :: EnumInfo -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c EnumInfo) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EnumInfo) # gmapT :: (forall b. Data b => b -> b) -> EnumInfo -> EnumInfo # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EnumInfo -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EnumInfo -> r # gmapQ :: (forall d. Data d => d -> u) -> EnumInfo -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> EnumInfo -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> EnumInfo -> m EnumInfo # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> EnumInfo -> m EnumInfo # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> EnumInfo -> m EnumInfo # | |
| Ord EnumInfo # | |
Defined in Text.ProtocolBuffers.Reflections | |
| Read EnumInfo # | |
| Show EnumInfo # | |
HsDefault stores the parsed default from the proto file in a
form that will make a nice literal in the
Language.Haskell.Exts.Syntax code generation by hprotoc.
Note that Utf8 labeled byte sequences have been stripped to just
ByteString here as this is sufficient for code generation.
On 25 August 2010 20:12, George van den Driessche georgevdd@google.com sent Chris Kuklewicz a patch to MakeReflections.parseDefEnum to ensure that HsDef'Enum holds the mangled form of the name.
Constructors
| HsDef'Bool Bool | |
| HsDef'ByteString ByteString | |
| HsDef'RealFloat SomeRealFloat | |
| HsDef'Integer Integer | |
| HsDef'Enum String |
Instances
| Eq HsDefault # | |
| Data HsDefault # | |
Defined in Text.ProtocolBuffers.Reflections Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> HsDefault -> c HsDefault # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c HsDefault # toConstr :: HsDefault -> Constr # dataTypeOf :: HsDefault -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c HsDefault) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c HsDefault) # gmapT :: (forall b. Data b => b -> b) -> HsDefault -> HsDefault # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> HsDefault -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> HsDefault -> r # gmapQ :: (forall d. Data d => d -> u) -> HsDefault -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> HsDefault -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> HsDefault -> m HsDefault # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> HsDefault -> m HsDefault # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> HsDefault -> m HsDefault # | |
| Ord HsDefault # | |
Defined in Text.ProtocolBuffers.Reflections | |
| Read HsDefault # | |
| Show HsDefault # | |
Constructors
| FieldInfo | |
Fields
| |
Instances
| Eq FieldInfo # | |
| Data FieldInfo # | |
Defined in Text.ProtocolBuffers.Reflections Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> FieldInfo -> c FieldInfo # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c FieldInfo # toConstr :: FieldInfo -> Constr # dataTypeOf :: FieldInfo -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c FieldInfo) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c FieldInfo) # gmapT :: (forall b. Data b => b -> b) -> FieldInfo -> FieldInfo # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> FieldInfo -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> FieldInfo -> r # gmapQ :: (forall d. Data d => d -> u) -> FieldInfo -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> FieldInfo -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> FieldInfo -> m FieldInfo # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> FieldInfo -> m FieldInfo # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> FieldInfo -> m FieldInfo # | |
| Ord FieldInfo # | |
Defined in Text.ProtocolBuffers.Reflections | |
| Read FieldInfo # | |
| Show FieldInfo # | |
data DescriptorInfo #
Constructors
| DescriptorInfo | |
Instances
Constructors
| ProtoInfo | |
Fields
| |
Instances
| Eq ProtoInfo # | |
| Data ProtoInfo # | |
Defined in Text.ProtocolBuffers.Reflections Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ProtoInfo -> c ProtoInfo # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ProtoInfo # toConstr :: ProtoInfo -> Constr # dataTypeOf :: ProtoInfo -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ProtoInfo) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProtoInfo) # gmapT :: (forall b. Data b => b -> b) -> ProtoInfo -> ProtoInfo # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ProtoInfo -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ProtoInfo -> r # gmapQ :: (forall d. Data d => d -> u) -> ProtoInfo -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ProtoInfo -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ProtoInfo -> m ProtoInfo # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ProtoInfo -> m ProtoInfo # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ProtoInfo -> m ProtoInfo # | |
| Ord ProtoInfo # | |
Defined in Text.ProtocolBuffers.Reflections | |
| Read ProtoInfo # | |
| Show ProtoInfo # | |
This is fully qualified name data type for code generation. The
haskellPrefix was possibly specified on the hprotoc command
line. The parentModule is a combination of the module prefix
from the '.proto' file and any nested levels of definition.
The name components are likely to have been mangled to ensure the
baseName started with an uppercase letter, in ['A'..'Z'] .
Constructors
| ProtoName | |
Fields
| |
Instances
| Eq ProtoName # | |
| Data ProtoName # | |
Defined in Text.ProtocolBuffers.Reflections Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> ProtoName -> c ProtoName # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c ProtoName # toConstr :: ProtoName -> Constr # dataTypeOf :: ProtoName -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c ProtoName) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c ProtoName) # gmapT :: (forall b. Data b => b -> b) -> ProtoName -> ProtoName # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> ProtoName -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> ProtoName -> r # gmapQ :: (forall d. Data d => d -> u) -> ProtoName -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> ProtoName -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> ProtoName -> m ProtoName # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> ProtoName -> m ProtoName # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> ProtoName -> m ProtoName # | |
| Ord ProtoName # | |
Defined in Text.ProtocolBuffers.Reflections | |
| Read ProtoName # | |
| Show ProtoName # | |
makePNF :: ByteString -> [String] -> [String] -> String -> ProtoName #
makePNF is used by the generated code to create a ProtoName with less newtype noise.
messagePutText :: TextMsg a => a -> String #
This writes message as text-format protobuf to String
messageGetText :: (TextMsg a, Stream s Identity Char) => s -> Either String a #
This reads message as text-format protobuf from any Parsec-compatible source. Input must be completely consumed.
runPut :: Put -> ByteString #
Run the Put monad with a serialiser
Instances
| Monad Get # | |
| Functor Get # | |
| Applicative Get # | |
| Alternative Get # | |
| MonadPlus Get # | |
| MonadError String Get # | |
Defined in Text.ProtocolBuffers.Get | |
The Wire class is for internal use, and may change. If there
is a mis-match between the FieldType and the type of b then you
will get a failure at runtime.
Users should stick to the message functions defined in Text.ProtocolBuffers.WireMessage and exported to use user by Text.ProtocolBuffers. These are less likely to change.
Minimal complete definition
Instances
| Wire Bool # | |
| Wire Double # | |
| Wire Float # | |
| Wire Int # | |
| Wire Int32 # | |
| Wire Int64 # | |
| Wire Word32 # | |
| Wire Word64 # | |
| Wire ByteString # | |
Defined in Text.ProtocolBuffers.WireMessage Methods wireSize :: FieldType -> ByteString -> WireSize # wirePut :: FieldType -> ByteString -> Put # wirePutWithSize :: FieldType -> ByteString -> PutM WireSize # wireGet :: FieldType -> Get ByteString # wireGetPacked :: FieldType -> Get (Seq ByteString) # | |
| Wire Utf8 # | |
messageSize :: (ReflectDescriptor msg, Wire msg) => msg -> WireSize #
This computes the size of the message's fields with tags on the wire with no initial tag or length (in bytes). This is also the length of the message as placed between group start and stop tags.
messageWithLengthSize :: (ReflectDescriptor msg, Wire msg) => msg -> WireSize #
This computes the size of the message fields as in messageSize
and add the length of the encoded size to the total. Thus this is
the the length of the message including the encoded length header,
but without any leading tag.
messageAsFieldSize :: (ReflectDescriptor msg, Wire msg) => FieldId -> msg -> WireSize #
This computes the size of the messageWithLengthSize and then
adds the length an initial tag with the given FieldId.
messagePut :: (ReflectDescriptor msg, Wire msg) => msg -> ByteString #
This is runPut applied to messagePutM. It result in a
ByteString with a length of messageSize bytes.
messageWithLengthPut :: (ReflectDescriptor msg, Wire msg) => msg -> ByteString #
This is runPut applied to messageWithLengthPutM. It results
in a ByteString with a length of messageWithLengthSize bytes.
messagePutM :: (ReflectDescriptor msg, Wire msg) => msg -> Put #
messageWithLengthPutM :: (ReflectDescriptor msg, Wire msg) => msg -> Put #
messageAsFieldPutM :: (ReflectDescriptor msg, Wire msg) => FieldId -> msg -> Put #
messageGet :: (ReflectDescriptor msg, Wire msg) => ByteString -> Either String (msg, ByteString) #
This consumes the ByteString to decode a message. It assumes
the ByteString is merely a sequence of the tagged fields of the
message, and consumes until a group stop tag is detected or the
entire input is consumed. Any ByteString past the end of the
stop tag is returned as well.
This is runGetOnLazy applied to messageGetM.
messageWithLengthGet :: (ReflectDescriptor msg, Wire msg) => ByteString -> Either String (msg, ByteString) #
This runGetOnLazy applied to messageWithLengthGetM.
This first reads the encoded length of the message and will then
succeed when it has consumed precisely this many additional bytes.
The ByteString after this point will be returned.
messageGetM :: (ReflectDescriptor msg, Wire msg) => Get msg #
This reads the tagged message fields until the stop tag or the end of input is reached.
This is actually wireGet 10 msg
messageWithLengthGetM :: (ReflectDescriptor msg, Wire msg) => Get msg #
This reads the encoded message length and then the message.
This is actually wireGet 11 msg
messageAsFieldGetM :: (ReflectDescriptor msg, Wire msg) => Get (FieldId, msg) #
runGetOnLazy :: Get r -> ByteString -> Either String (r, ByteString) #
This is like runGet, without the ability to pass in more input
beyond the initial ByteString. Thus the ByteString argument is
taken to be the entire input. To be able to incrementally feed in
more input you should use runGet and respond to Partial
differently.