protobuf-0.2.1.3: Google Protocol Buffers via GHC.Generics

Safe HaskellNone
LanguageHaskell2010

Data.ProtocolBuffers

Contents

Description

An implementation of Protocol Buffers in pure Haskell.

Extensive documentation is available at https://developers.google.com/protocol-buffers/docs/overview 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 vice versa.

Given a message definition:

{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DataKinds     #-}

import Data.Int
import Data.ProtocolBuffers
import Data.Text
import GHC.Generics (Generic)
import GHC.TypeLits
import Data.Monoid
import Data.Serialize
import Data.Hex  -- cabal install hex (for testing)

 data Foo = Foo
   { field1 :: RequiredField 1 (Value Int64) -- ^ The last field with tag = 1
   , field2 :: OptionalField 2 (Value Text) -- ^ The last field with tag = 2
   , field3 :: RepeatedField 3 (Value Bool)   -- ^ All fields with tag = 3, ordering is preserved
   } deriving (Generic, Show)

instance Encode Foo
instance Decode Foo
 

It can then be used for encoding and decoding. The Encode and Decode instances are derived automatically using DeriveGeneric and DefaultSignatures as outlined here: http://www.haskell.org/haskellwiki/GHC.Generics#More_general_default_methods.

To construct a message, use putField to set each field value. OptionalField, RepeatedField and Packed fields can be set to their empty value by using mempty. An example using record syntax for clarity:

>>> let msg = Foo{field1 = putField 42, field2 = mempty, field3 = putField [True, False]}

To serialize a message first convert it into a Put by way of encodeMessage and then to a ByteString by using runPut. Lazy ByteString serialization is done with runPutLazy.

>>> fmap hex runPut $ encodeMessage msg
"082A18011800"

Decoding is done with the inverse functions: decodeMessage and runGet, or runGetLazy.

>>> runGet decodeMessage =<< unhex "082A18011800" :: Either String Foo
Right
  (Foo
    { field1 = Field {runField = Required {runRequired = Always {runAlways = Value {runValue = 42}}}}
    , field2 = Field {runField = Optional {runOptional = Last {getLast = Nothing}}}
    , field3 = Field {runField = Repeated {runRepeated = [Value {runValue = True},Value {runValue = False}]}}
    }
  )

Use getField to read fields from a message:

>>> let Right msg = runGet decodeMessage =<< unhex "082A18011800" :: Either String Foo
>>> getField $ field1 msg
42
>>> getField $ field2 msg
Nothing
>>> getField $ field3 msg
[True,False]

Some Protocol Buffers features are not currently implemented:

  • Default values for OptionalField fields
  • Extension fields
  • Storing unknown fields, those without a mapped field tag in message record
  • Tag-delimited Groups, deprecated in lieu of Message
Synopsis

Message Serialization

Encoding

class Encode (a :: *) where Source #

Minimal complete definition

Nothing

Methods

encode :: a -> Put Source #

encode :: (Generic a, GEncode (Rep a)) => a -> Put Source #

Instances
Encode (HashMap Tag [WireField]) Source #

Untyped message encoding

Instance details

Defined in Data.ProtocolBuffers.Encode

encodeMessage :: Encode a => a -> Put Source #

Encode a Protocol Buffers message.

encodeLengthPrefixedMessage :: Encode a => a -> Put Source #

Encode a Protocol Buffers message prefixed with a varint encoded 32-bit integer describing its length.

Decoding

class Decode (a :: *) where Source #

Minimal complete definition

Nothing

Instances
Decode (HashMap Tag [WireField]) Source #

Untyped message decoding, decode = id

Instance details

Defined in Data.ProtocolBuffers.Decode

decodeMessage :: Decode a => Get a Source #

Decode a Protocol Buffers message.

decodeLengthPrefixedMessage :: Decode a => Get a Source #

Decode a Protocol Buffers message prefixed with a varint encoded 32-bit integer describing its length.

Fields

Tags

Restricted type aliases of Field. These are used to attach a field tag (a numeric id) to a field. Each tag must be unique within a given message, though this is not currently checked or enforced.

type family Required (n :: Nat) (a :: *) :: * Source #

Required fields. Parsing will return empty if a RequiredField value is not found while decoding.

Instances
type Required n (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type Required n (Value a) = Field n (RequiredField (Always (Value a)))
type Required n (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type Required n (Message a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

type family Optional (n :: Nat) (a :: *) :: * Source #

Optional fields. Values that are not found will return Nothing.

Instances
type Optional n (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type Optional n (Value a) = Field n (OptionalField (Last (Value a)))
type Optional n (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type Optional n (Message a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

type Repeated n a = Field n (RepeatedField [a]) Source #

Lists of values.

type Packed n a = Field n (PackedField (PackedList a)) Source #

Packed values.

Accessors

Fields tend to have rather complex types that are unpleasant to interact with. HasField was designed to hide this complexity and provide a consistent way of getting and setting fields.

class HasField a where Source #

Functions for wrapping and unwrapping record fields. When applied they will have types similar to these:

getField :: RequiredField '1' (Value Text) -> Text
putField :: Text -> RequiredField '1' (Value Text)

getField :: OptionalField '2' (Value Int32) -> Maybe Int32
putField :: Maybe Int32 -> OptionalField '2' (Value Int32)

getField :: RepeatedField '3' (Value Double) -> [Double]
putField :: [Double] -> RepeatedField '3' (Value Double)

getField :: Packed '4' (Value Word64) -> [Word64]
putField :: [Word64] -> Packed '4' (Value Word64)
 

Minimal complete definition

getField, putField

Associated Types

type FieldType a :: * Source #

Methods

getField :: a -> FieldType a Source #

Extract a value from it's Field representation.

putField :: FieldType a -> a Source #

Wrap it back up again.

field :: Functor f => (FieldType a -> f (FieldType a)) -> a -> f a Source #

An isomorphism lens compatible with the lens package

Instances
HasField (Field n (PackedField (PackedList (Enumeration a)))) Source #

Iso: FieldType (Packed n (Enumeration a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (PackedField (PackedList (Enumeration a)))) :: Type Source #

HasField (Field n (PackedField (PackedList (Value a)))) Source #

Iso: FieldType (Packed n (Value a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (PackedField (PackedList (Value a)))) :: Type Source #

HasField (Field n (RepeatedField [Enumeration a])) Source #

Iso: FieldType (RepeatedField n (Enumeration a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (RepeatedField [Enumeration a])) :: Type Source #

HasField (Field n (RepeatedField [Value a])) Source #

Iso: FieldType (RepeatedField n (Value a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (RepeatedField [Value a])) :: Type Source #

HasField (Field n (OptionalField (Last (Enumeration a)))) Source #

Iso: FieldType (OptionalField n (Enumeration a)) = Maybe a

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (OptionalField (Last (Enumeration a)))) :: Type Source #

HasField (Field n (OptionalField (Last (Value a)))) Source #

Iso: FieldType (OptionalField n (Value a)) = Maybe a

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (OptionalField (Last (Value a)))) :: Type Source #

HasField (Field n (RequiredField (Always (Enumeration a)))) Source #

Iso: FieldType (RequiredField n (Enumeration a)) = a

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (RequiredField (Always (Enumeration a)))) :: Type Source #

HasField (Field n (RequiredField (Always (Value a)))) Source #

Iso: FieldType (RequiredField n (Value a)) = a

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (RequiredField (Always (Value a)))) :: Type Source #

HasField (Field n (RepeatedField [Message a])) Source #

Iso: FieldType (RepeatedField n (Message a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Message

Associated Types

type FieldType (Field n (RepeatedField [Message a])) :: Type Source #

HasField (Field n (OptionalField (Maybe (Message a)))) Source #

Iso: FieldType (OptionalField n (Message a)) = Maybe a

Instance details

Defined in Data.ProtocolBuffers.Message

Associated Types

type FieldType (Field n (OptionalField (Maybe (Message a)))) :: Type Source #

HasField (Field n (RequiredField (Always (Message a)))) Source #

Iso: FieldType (RequiredField n (Message a)) = a

Instance details

Defined in Data.ProtocolBuffers.Message

Associated Types

type FieldType (Field n (RequiredField (Always (Message a)))) :: Type Source #

Selectors

Follow these rules to define fields supported by the generic encoder/decoder:

  • The n phantom type parameter specifies the Protocol Buffers field tag (id).
  • Field tags must be an instance of Nat.
  • Field selectors must be an instance of Foldable to support encoding.
  • Value selectors must be an instance of Monoid to support decoding.

data Field (n :: Nat) a Source #

Fields are merely a way to hold a field tag along with its type, this shouldn't normally be referenced directly.

This provides better error messages than older versions which used Tagged

Instances
Functor (Field n) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

fmap :: (a -> b) -> Field n a -> Field n b #

(<$) :: a -> Field n b -> Field n a #

Foldable (Field n) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

fold :: Monoid m => Field n m -> m #

foldMap :: Monoid m => (a -> m) -> Field n a -> m #

foldr :: (a -> b -> b) -> b -> Field n a -> b #

foldr' :: (a -> b -> b) -> b -> Field n a -> b #

foldl :: (b -> a -> b) -> b -> Field n a -> b #

foldl' :: (b -> a -> b) -> b -> Field n a -> b #

foldr1 :: (a -> a -> a) -> Field n a -> a #

foldl1 :: (a -> a -> a) -> Field n a -> a #

toList :: Field n a -> [a] #

null :: Field n a -> Bool #

length :: Field n a -> Int #

elem :: Eq a => a -> Field n a -> Bool #

maximum :: Ord a => Field n a -> a #

minimum :: Ord a => Field n a -> a #

sum :: Num a => Field n a -> a #

product :: Num a => Field n a -> a #

Traversable (Field n) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

traverse :: Applicative f => (a -> f b) -> Field n a -> f (Field n b) #

sequenceA :: Applicative f => Field n (f a) -> f (Field n a) #

mapM :: Monad m => (a -> m b) -> Field n a -> m (Field n b) #

sequence :: Monad m => Field n (m a) -> m (Field n a) #

Bounded a => Bounded (Field n a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

minBound :: Field n a #

maxBound :: Field n a #

Enum a => Enum (Field n a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

succ :: Field n a -> Field n a #

pred :: Field n a -> Field n a #

toEnum :: Int -> Field n a #

fromEnum :: Field n a -> Int #

enumFrom :: Field n a -> [Field n a] #

enumFromThen :: Field n a -> Field n a -> [Field n a] #

enumFromTo :: Field n a -> Field n a -> [Field n a] #

enumFromThenTo :: Field n a -> Field n a -> Field n a -> [Field n a] #

Eq a => Eq (Field n a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(==) :: Field n a -> Field n a -> Bool #

(/=) :: Field n a -> Field n a -> Bool #

Ord a => Ord (Field n a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

compare :: Field n a -> Field n a -> Ordering #

(<) :: Field n a -> Field n a -> Bool #

(<=) :: Field n a -> Field n a -> Bool #

(>) :: Field n a -> Field n a -> Bool #

(>=) :: Field n a -> Field n a -> Bool #

max :: Field n a -> Field n a -> Field n a #

min :: Field n a -> Field n a -> Field n a #

Show a => Show (Field n a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

showsPrec :: Int -> Field n a -> ShowS #

show :: Field n a -> String #

showList :: [Field n a] -> ShowS #

Semigroup a => Semigroup (Field n a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(<>) :: Field n a -> Field n a -> Field n a #

sconcat :: NonEmpty (Field n a) -> Field n a #

stimes :: Integral b => b -> Field n a -> Field n a #

Monoid a => Monoid (Field n a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

mempty :: Field n a #

mappend :: Field n a -> Field n a -> Field n a #

mconcat :: [Field n a] -> Field n a #

NFData a => NFData (Field n a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

rnf :: Field n a -> () #

HasField (Field n (PackedField (PackedList (Enumeration a)))) Source #

Iso: FieldType (Packed n (Enumeration a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (PackedField (PackedList (Enumeration a)))) :: Type Source #

HasField (Field n (PackedField (PackedList (Value a)))) Source #

Iso: FieldType (Packed n (Value a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (PackedField (PackedList (Value a)))) :: Type Source #

HasField (Field n (RepeatedField [Enumeration a])) Source #

Iso: FieldType (RepeatedField n (Enumeration a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (RepeatedField [Enumeration a])) :: Type Source #

HasField (Field n (RepeatedField [Value a])) Source #

Iso: FieldType (RepeatedField n (Value a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (RepeatedField [Value a])) :: Type Source #

HasField (Field n (OptionalField (Last (Enumeration a)))) Source #

Iso: FieldType (OptionalField n (Enumeration a)) = Maybe a

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (OptionalField (Last (Enumeration a)))) :: Type Source #

HasField (Field n (OptionalField (Last (Value a)))) Source #

Iso: FieldType (OptionalField n (Value a)) = Maybe a

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (OptionalField (Last (Value a)))) :: Type Source #

HasField (Field n (RequiredField (Always (Enumeration a)))) Source #

Iso: FieldType (RequiredField n (Enumeration a)) = a

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (RequiredField (Always (Enumeration a)))) :: Type Source #

HasField (Field n (RequiredField (Always (Value a)))) Source #

Iso: FieldType (RequiredField n (Value a)) = a

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (RequiredField (Always (Value a)))) :: Type Source #

HasField (Field n (RepeatedField [Message a])) Source #

Iso: FieldType (RepeatedField n (Message a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Message

Associated Types

type FieldType (Field n (RepeatedField [Message a])) :: Type Source #

HasField (Field n (OptionalField (Maybe (Message a)))) Source #

Iso: FieldType (OptionalField n (Message a)) = Maybe a

Instance details

Defined in Data.ProtocolBuffers.Message

Associated Types

type FieldType (Field n (OptionalField (Maybe (Message a)))) :: Type Source #

HasField (Field n (RequiredField (Always (Message a)))) Source #

Iso: FieldType (RequiredField n (Message a)) = a

Instance details

Defined in Data.ProtocolBuffers.Message

Associated Types

type FieldType (Field n (RequiredField (Always (Message a)))) :: Type Source #

(EncodeWire a, KnownNat n, Foldable f) => GEncode (K1 i (Field n (f a)) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Encode

Methods

gencode :: K1 i (Field n (f a)) a0 -> Put

(DecodeWire (PackedList a), KnownNat n) => GDecode (K1 i (Packed n a) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Decode

Methods

gdecode :: HashMap Tag [WireField] -> Get (K1 i (Packed n a) a0)

(DecodeWire a, KnownNat n) => GDecode (K1 i (Field n (RequiredField (Always (Value a)))) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Decode

Methods

gdecode :: HashMap Tag [WireField] -> Get (K1 i (Field n (RequiredField (Always (Value a)))) a0)

(DecodeWire a, KnownNat n) => GDecode (K1 i (Repeated n a) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Decode

Methods

gdecode :: HashMap Tag [WireField] -> Get (K1 i (Repeated n a) a0)

(Enum a, KnownNat n) => GDecode (K1 i (Field n (OptionalField (Last (Enumeration a)))) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Decode

Methods

gdecode :: HashMap Tag [WireField] -> Get (K1 i (Field n (OptionalField (Last (Enumeration a)))) a0)

(Enum a, KnownNat n) => GDecode (K1 i (Field n (RequiredField (Always (Enumeration a)))) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Decode

(DecodeWire a, KnownNat n) => GDecode (K1 i (Field n (OptionalField (Last (Value a)))) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Decode

Methods

gdecode :: HashMap Tag [WireField] -> Get (K1 i (Field n (OptionalField (Last (Value a)))) a0)

(Decode a, Monoid (Message a), KnownNat n) => GDecode (K1 i (Field n (OptionalField (Maybe (Message a)))) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

gdecode :: HashMap Tag [WireField] -> Get (K1 i (Field n (OptionalField (Maybe (Message a)))) a0)

(Decode a, Monoid (Message a), KnownNat n) => GDecode (K1 i (Field n (RequiredField (Always (Message a)))) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

gdecode :: HashMap Tag [WireField] -> Get (K1 i (Field n (RequiredField (Always (Message a)))) a0)

type FieldType (Field n (RepeatedField [Value a])) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (RepeatedField [Value a])) = [a]
type FieldType (Field n (OptionalField (Last (Value a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (RequiredField (Always (Value a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (RepeatedField [Enumeration a])) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (OptionalField (Last (Enumeration a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (RequiredField (Always (Enumeration a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (PackedField (PackedList (Enumeration a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (PackedField (PackedList (Value a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (PackedField (PackedList (Value a)))) = [a]
type FieldType (Field n (RepeatedField [Message a])) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

type FieldType (Field n (RepeatedField [Message a])) = [a]
type FieldType (Field n (OptionalField (Maybe (Message a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

type FieldType (Field n (RequiredField (Always (Message a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Values

Selectors

Each field value needs to specify the way it should be encoded.

There are three built-in value selectors: Value, Enumeration and Message.

If you're unsure what value selector to use, Value is probably the correct one.

data Value a Source #

Value selects the normal/typical way for encoding scalar (primitive) values.

Instances
Functor Value Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

fmap :: (a -> b) -> Value a -> Value b #

(<$) :: a -> Value b -> Value a #

Foldable Value Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

fold :: Monoid m => Value m -> m #

foldMap :: Monoid m => (a -> m) -> Value a -> m #

foldr :: (a -> b -> b) -> b -> Value a -> b #

foldr' :: (a -> b -> b) -> b -> Value a -> b #

foldl :: (b -> a -> b) -> b -> Value a -> b #

foldl' :: (b -> a -> b) -> b -> Value a -> b #

foldr1 :: (a -> a -> a) -> Value a -> a #

foldl1 :: (a -> a -> a) -> Value a -> a #

toList :: Value a -> [a] #

null :: Value a -> Bool #

length :: Value a -> Int #

elem :: Eq a => a -> Value a -> Bool #

maximum :: Ord a => Value a -> a #

minimum :: Ord a => Value a -> a #

sum :: Num a => Value a -> a #

product :: Num a => Value a -> a #

Traversable Value Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

traverse :: Applicative f => (a -> f b) -> Value a -> f (Value b) #

sequenceA :: Applicative f => Value (f a) -> f (Value a) #

mapM :: Monad m => (a -> m b) -> Value a -> m (Value b) #

sequence :: Monad m => Value (m a) -> m (Value a) #

Bounded a => Bounded (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

minBound :: Value a #

maxBound :: Value a #

Enum a => Enum (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

succ :: Value a -> Value a #

pred :: Value a -> Value a #

toEnum :: Int -> Value a #

fromEnum :: Value a -> Int #

enumFrom :: Value a -> [Value a] #

enumFromThen :: Value a -> Value a -> [Value a] #

enumFromTo :: Value a -> Value a -> [Value a] #

enumFromThenTo :: Value a -> Value a -> Value a -> [Value a] #

Eq a => Eq (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(==) :: Value a -> Value a -> Bool #

(/=) :: Value a -> Value a -> Bool #

Ord a => Ord (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

compare :: Value a -> Value a -> Ordering #

(<) :: Value a -> Value a -> Bool #

(<=) :: Value a -> Value a -> Bool #

(>) :: Value a -> Value a -> Bool #

(>=) :: Value a -> Value a -> Bool #

max :: Value a -> Value a -> Value a #

min :: Value a -> Value a -> Value a #

Show a => Show (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

showsPrec :: Int -> Value a -> ShowS #

show :: Value a -> String #

showList :: [Value a] -> ShowS #

Semigroup a => Semigroup (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(<>) :: Value a -> Value a -> Value a #

sconcat :: NonEmpty (Value a) -> Value a #

stimes :: Integral b => b -> Value a -> Value a #

Monoid a => Monoid (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

mempty :: Value a #

mappend :: Value a -> Value a -> Value a #

mconcat :: [Value a] -> Value a #

NFData a => NFData (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

rnf :: Value a -> () #

DecodeWire a => DecodeWire (Maybe (Value a)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire a => DecodeWire (Last (Value a)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value Bool)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value Double)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value Float)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value Int32)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value Int64)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value Word32)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value Word64)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value (Fixed Int32))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value (Fixed Int64))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value (Fixed Word32))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value (Fixed Word64))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value (Signed Int32))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value (Signed Int64))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire a => DecodeWire (Always (Value a)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire a => DecodeWire (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire a => EncodeWire [Value a] Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

Methods

encodeWire :: Tag -> [Value a] -> Put Source #

EncodeWire a => EncodeWire (Maybe (Value a)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

Methods

encodeWire :: Tag -> Maybe (Value a) -> Put Source #

EncodeWire a => EncodeWire (Last (Value a)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

Methods

encodeWire :: Tag -> Last (Value a) -> Put Source #

EncodeWire (PackedList (Value Bool)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value Double)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value Float)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value Int32)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value Int64)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value Word32)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value Word64)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value (Fixed Int32))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value (Fixed Int64))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value (Fixed Word32))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value (Fixed Word64))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value (Signed Int32))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value (Signed Int64))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire a => EncodeWire (Always (Value a)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

Methods

encodeWire :: Tag -> Always (Value a) -> Put Source #

EncodeWire a => EncodeWire (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

Methods

encodeWire :: Tag -> Value a -> Put Source #

HasField (Field n (PackedField (PackedList (Value a)))) Source #

Iso: FieldType (Packed n (Value a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (PackedField (PackedList (Value a)))) :: Type Source #

HasField (Field n (RepeatedField [Value a])) Source #

Iso: FieldType (RepeatedField n (Value a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (RepeatedField [Value a])) :: Type Source #

HasField (Field n (OptionalField (Last (Value a)))) Source #

Iso: FieldType (OptionalField n (Value a)) = Maybe a

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (OptionalField (Last (Value a)))) :: Type Source #

HasField (Field n (RequiredField (Always (Value a)))) Source #

Iso: FieldType (RequiredField n (Value a)) = a

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (RequiredField (Always (Value a)))) :: Type Source #

(DecodeWire a, KnownNat n) => GDecode (K1 i (Field n (RequiredField (Always (Value a)))) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Decode

Methods

gdecode :: HashMap Tag [WireField] -> Get (K1 i (Field n (RequiredField (Always (Value a)))) a0)

(DecodeWire a, KnownNat n) => GDecode (K1 i (Field n (OptionalField (Last (Value a)))) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Decode

Methods

gdecode :: HashMap Tag [WireField] -> Get (K1 i (Field n (OptionalField (Last (Value a)))) a0)

type Required n (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type Required n (Value a) = Field n (RequiredField (Always (Value a)))
type Optional n (Value a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type Optional n (Value a) = Field n (OptionalField (Last (Value a)))
type FieldType (Field n (RepeatedField [Value a])) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (RepeatedField [Value a])) = [a]
type FieldType (Field n (OptionalField (Last (Value a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (RequiredField (Always (Value a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (PackedField (PackedList (Value a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (PackedField (PackedList (Value a)))) = [a]

data Enumeration a Source #

Enumeration fields use fromEnum and toEnum when encoding and decoding messages.

Instances
Functor Enumeration Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

fmap :: (a -> b) -> Enumeration a -> Enumeration b #

(<$) :: a -> Enumeration b -> Enumeration a #

Foldable Enumeration Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

fold :: Monoid m => Enumeration m -> m #

foldMap :: Monoid m => (a -> m) -> Enumeration a -> m #

foldr :: (a -> b -> b) -> b -> Enumeration a -> b #

foldr' :: (a -> b -> b) -> b -> Enumeration a -> b #

foldl :: (b -> a -> b) -> b -> Enumeration a -> b #

foldl' :: (b -> a -> b) -> b -> Enumeration a -> b #

foldr1 :: (a -> a -> a) -> Enumeration a -> a #

foldl1 :: (a -> a -> a) -> Enumeration a -> a #

toList :: Enumeration a -> [a] #

null :: Enumeration a -> Bool #

length :: Enumeration a -> Int #

elem :: Eq a => a -> Enumeration a -> Bool #

maximum :: Ord a => Enumeration a -> a #

minimum :: Ord a => Enumeration a -> a #

sum :: Num a => Enumeration a -> a #

product :: Num a => Enumeration a -> a #

Traversable Enumeration Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

traverse :: Applicative f => (a -> f b) -> Enumeration a -> f (Enumeration b) #

sequenceA :: Applicative f => Enumeration (f a) -> f (Enumeration a) #

mapM :: Monad m => (a -> m b) -> Enumeration a -> m (Enumeration b) #

sequence :: Monad m => Enumeration (m a) -> m (Enumeration a) #

Bounded a => Bounded (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Enum a => Enum (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Eq a => Eq (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Ord a => Ord (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Show a => Show (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Semigroup a => Semigroup (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Monoid a => Monoid (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

NFData a => NFData (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

rnf :: Enumeration a -> () #

Enum a => DecodeWire (Maybe (Enumeration a)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

Enum a => DecodeWire (PackedList (Enumeration a)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

Enum a => DecodeWire (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

Enum a => DecodeWire (Always (Enumeration a)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

(Foldable f, Enum a) => EncodeWire (f (Enumeration a)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

Methods

encodeWire :: Tag -> f (Enumeration a) -> Put Source #

Enum a => EncodeWire (PackedList (Enumeration a)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

HasField (Field n (PackedField (PackedList (Enumeration a)))) Source #

Iso: FieldType (Packed n (Enumeration a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (PackedField (PackedList (Enumeration a)))) :: Type Source #

HasField (Field n (RepeatedField [Enumeration a])) Source #

Iso: FieldType (RepeatedField n (Enumeration a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (RepeatedField [Enumeration a])) :: Type Source #

HasField (Field n (OptionalField (Last (Enumeration a)))) Source #

Iso: FieldType (OptionalField n (Enumeration a)) = Maybe a

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (OptionalField (Last (Enumeration a)))) :: Type Source #

HasField (Field n (RequiredField (Always (Enumeration a)))) Source #

Iso: FieldType (RequiredField n (Enumeration a)) = a

Instance details

Defined in Data.ProtocolBuffers.Types

Associated Types

type FieldType (Field n (RequiredField (Always (Enumeration a)))) :: Type Source #

(Enum a, KnownNat n) => GDecode (K1 i (Field n (OptionalField (Last (Enumeration a)))) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Decode

Methods

gdecode :: HashMap Tag [WireField] -> Get (K1 i (Field n (OptionalField (Last (Enumeration a)))) a0)

(Enum a, KnownNat n) => GDecode (K1 i (Field n (RequiredField (Always (Enumeration a)))) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Decode

type Required n (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type Optional n (Enumeration a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (RepeatedField [Enumeration a])) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (OptionalField (Last (Enumeration a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (RequiredField (Always (Enumeration a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

type FieldType (Field n (PackedField (PackedList (Enumeration a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

data Message m Source #

The way to embed a message within another message. These embedded messages are stored as length-delimited fields.

For example:

data Inner = Inner
   { innerField :: Required '1' (Value Int64)
   } deriving (Generic, Show)

 instance Encode Inner
instance Decode Inner

 data Outer = Outer
   { outerField :: Required '1' (Message Inner)
   } deriving (Generic, Show)

 instance Encode Outer
instance Decode Outer
 

It's worth noting that Message a is a Monoid and NFData instance. The Monoid behavior models that of the Protocol Buffers documentation, effectively Last. It's done with a fairly big hammer and it isn't possible to override this behavior. This can cause some less-obvious compile errors for paramterized Message types:

data Inner = Inner{inner :: RequiredField '2' (Value Float)} deriving (Generic, Show)
instance Encode Inner
instance Decode Inner

data Outer a = Outer{outer :: RequiredField '3' (Message a)} deriving (Generic, Show)
instance Encode a => Encode (Outer a)
instance Decode a => Decode (Outer a)
 

This fails because Decode needs to know that the message can be merged. The resulting error implies that you may want to add a constraint to the internal GMessageMonoid class:

/tmp/tst.hs:18:10:
  Could not deduce (protobuf-0.1:GMessageMonoid (Rep a))
    arising from a use of `protobuf-0.1: Decode .$gdmdecode'
  from the context (Decode a)
    bound by the instance declaration at /tmp/tst.hs:18:10-39
  Possible fix:
    add an instance declaration for
    (protobuf-0.1:GMessageMonoid (Rep a))
  In the expression:
    (protobuf-0.1:Decode.$gdmdecode)
  In an equation for decode:
      decode = (protobuf-0.1:Decode .$gdmdecode)
  In the instance declaration for `Decode (Outer a)'

The correct fix is to add the Monoid constraint for the message:

- instance (Encode a) => Decode (Outer a)
+ instance (Monoid (Message a), Decode a) => Decode (Outer a)
Instances
Functor Message Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

fmap :: (a -> b) -> Message a -> Message b #

(<$) :: a -> Message b -> Message a #

Foldable Message Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

fold :: Monoid m => Message m -> m #

foldMap :: Monoid m => (a -> m) -> Message a -> m #

foldr :: (a -> b -> b) -> b -> Message a -> b #

foldr' :: (a -> b -> b) -> b -> Message a -> b #

foldl :: (b -> a -> b) -> b -> Message a -> b #

foldl' :: (b -> a -> b) -> b -> Message a -> b #

foldr1 :: (a -> a -> a) -> Message a -> a #

foldl1 :: (a -> a -> a) -> Message a -> a #

toList :: Message a -> [a] #

null :: Message a -> Bool #

length :: Message a -> Int #

elem :: Eq a => a -> Message a -> Bool #

maximum :: Ord a => Message a -> a #

minimum :: Ord a => Message a -> a #

sum :: Num a => Message a -> a #

product :: Num a => Message a -> a #

Traversable Message Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

traverse :: Applicative f => (a -> f b) -> Message a -> f (Message b) #

sequenceA :: Applicative f => Message (f a) -> f (Message a) #

mapM :: Monad m => (a -> m b) -> Message a -> m (Message b) #

sequence :: Monad m => Message (m a) -> m (Message a) #

Eq m => Eq (Message m) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

(==) :: Message m -> Message m -> Bool #

(/=) :: Message m -> Message m -> Bool #

Ord m => Ord (Message m) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

compare :: Message m -> Message m -> Ordering #

(<) :: Message m -> Message m -> Bool #

(<=) :: Message m -> Message m -> Bool #

(>) :: Message m -> Message m -> Bool #

(>=) :: Message m -> Message m -> Bool #

max :: Message m -> Message m -> Message m #

min :: Message m -> Message m -> Message m #

Show m => Show (Message m) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

showsPrec :: Int -> Message m -> ShowS #

show :: Message m -> String #

showList :: [Message m] -> ShowS #

(Generic m, GMessageMonoid (Rep m)) => Semigroup (Message m) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

(<>) :: Message m -> Message m -> Message m #

sconcat :: NonEmpty (Message m) -> Message m #

stimes :: Integral b => b -> Message m -> Message m #

(Generic m, GMessageMonoid (Rep m)) => Monoid (Message m) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

mempty :: Message m #

mappend :: Message m -> Message m -> Message m #

mconcat :: [Message m] -> Message m #

(Generic m, GMessageNFData (Rep m)) => NFData (Message m) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

rnf :: Message m -> () #

Decode m => DecodeWire (Message m) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

(Foldable f, Encode m) => EncodeWire (f (Message m)) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

encodeWire :: Tag -> f (Message m) -> Put Source #

HasField (Field n (RepeatedField [Message a])) Source #

Iso: FieldType (RepeatedField n (Message a)) = [a]

Instance details

Defined in Data.ProtocolBuffers.Message

Associated Types

type FieldType (Field n (RepeatedField [Message a])) :: Type Source #

HasField (Field n (OptionalField (Maybe (Message a)))) Source #

Iso: FieldType (OptionalField n (Message a)) = Maybe a

Instance details

Defined in Data.ProtocolBuffers.Message

Associated Types

type FieldType (Field n (OptionalField (Maybe (Message a)))) :: Type Source #

HasField (Field n (RequiredField (Always (Message a)))) Source #

Iso: FieldType (RequiredField n (Message a)) = a

Instance details

Defined in Data.ProtocolBuffers.Message

Associated Types

type FieldType (Field n (RequiredField (Always (Message a)))) :: Type Source #

(Decode a, Monoid (Message a), KnownNat n) => GDecode (K1 i (Field n (OptionalField (Maybe (Message a)))) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

gdecode :: HashMap Tag [WireField] -> Get (K1 i (Field n (OptionalField (Maybe (Message a)))) a0)

(Decode a, Monoid (Message a), KnownNat n) => GDecode (K1 i (Field n (RequiredField (Always (Message a)))) :: Type -> Type) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Methods

gdecode :: HashMap Tag [WireField] -> Get (K1 i (Field n (RequiredField (Always (Message a)))) a0)

type Required n (Message a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

type Optional n (Message a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

type FieldType (Field n (RepeatedField [Message a])) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

type FieldType (Field n (RepeatedField [Message a])) = [a]
type FieldType (Field n (OptionalField (Maybe (Message a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

type FieldType (Field n (RequiredField (Always (Message a)))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Message

Wire Coding

Some primitive values can be more compactly represented. Fields that typically contain negative or very large numbers should use the Signed or Fixed wrappers to select their respective (efficient) formats.

newtype Signed a Source #

Signed integers are stored in a zz-encoded form.

Constructors

Signed a 
Instances
Functor Signed Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

fmap :: (a -> b) -> Signed a -> Signed b #

(<$) :: a -> Signed b -> Signed a #

Foldable Signed Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

fold :: Monoid m => Signed m -> m #

foldMap :: Monoid m => (a -> m) -> Signed a -> m #

foldr :: (a -> b -> b) -> b -> Signed a -> b #

foldr' :: (a -> b -> b) -> b -> Signed a -> b #

foldl :: (b -> a -> b) -> b -> Signed a -> b #

foldl' :: (b -> a -> b) -> b -> Signed a -> b #

foldr1 :: (a -> a -> a) -> Signed a -> a #

foldl1 :: (a -> a -> a) -> Signed a -> a #

toList :: Signed a -> [a] #

null :: Signed a -> Bool #

length :: Signed a -> Int #

elem :: Eq a => a -> Signed a -> Bool #

maximum :: Ord a => Signed a -> a #

minimum :: Ord a => Signed a -> a #

sum :: Num a => Signed a -> a #

product :: Num a => Signed a -> a #

Traversable Signed Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

traverse :: Applicative f => (a -> f b) -> Signed a -> f (Signed b) #

sequenceA :: Applicative f => Signed (f a) -> f (Signed a) #

mapM :: Monad m => (a -> m b) -> Signed a -> m (Signed b) #

sequence :: Monad m => Signed (m a) -> m (Signed a) #

Bounded a => Bounded (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

minBound :: Signed a #

maxBound :: Signed a #

Enum a => Enum (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

succ :: Signed a -> Signed a #

pred :: Signed a -> Signed a #

toEnum :: Int -> Signed a #

fromEnum :: Signed a -> Int #

enumFrom :: Signed a -> [Signed a] #

enumFromThen :: Signed a -> Signed a -> [Signed a] #

enumFromTo :: Signed a -> Signed a -> [Signed a] #

enumFromThenTo :: Signed a -> Signed a -> Signed a -> [Signed a] #

Eq a => Eq (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(==) :: Signed a -> Signed a -> Bool #

(/=) :: Signed a -> Signed a -> Bool #

Floating a => Floating (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

pi :: Signed a #

exp :: Signed a -> Signed a #

log :: Signed a -> Signed a #

sqrt :: Signed a -> Signed a #

(**) :: Signed a -> Signed a -> Signed a #

logBase :: Signed a -> Signed a -> Signed a #

sin :: Signed a -> Signed a #

cos :: Signed a -> Signed a #

tan :: Signed a -> Signed a #

asin :: Signed a -> Signed a #

acos :: Signed a -> Signed a #

atan :: Signed a -> Signed a #

sinh :: Signed a -> Signed a #

cosh :: Signed a -> Signed a #

tanh :: Signed a -> Signed a #

asinh :: Signed a -> Signed a #

acosh :: Signed a -> Signed a #

atanh :: Signed a -> Signed a #

log1p :: Signed a -> Signed a #

expm1 :: Signed a -> Signed a #

log1pexp :: Signed a -> Signed a #

log1mexp :: Signed a -> Signed a #

Fractional a => Fractional (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(/) :: Signed a -> Signed a -> Signed a #

recip :: Signed a -> Signed a #

fromRational :: Rational -> Signed a #

Integral a => Integral (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

quot :: Signed a -> Signed a -> Signed a #

rem :: Signed a -> Signed a -> Signed a #

div :: Signed a -> Signed a -> Signed a #

mod :: Signed a -> Signed a -> Signed a #

quotRem :: Signed a -> Signed a -> (Signed a, Signed a) #

divMod :: Signed a -> Signed a -> (Signed a, Signed a) #

toInteger :: Signed a -> Integer #

Num a => Num (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(+) :: Signed a -> Signed a -> Signed a #

(-) :: Signed a -> Signed a -> Signed a #

(*) :: Signed a -> Signed a -> Signed a #

negate :: Signed a -> Signed a #

abs :: Signed a -> Signed a #

signum :: Signed a -> Signed a #

fromInteger :: Integer -> Signed a #

Ord a => Ord (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

compare :: Signed a -> Signed a -> Ordering #

(<) :: Signed a -> Signed a -> Bool #

(<=) :: Signed a -> Signed a -> Bool #

(>) :: Signed a -> Signed a -> Bool #

(>=) :: Signed a -> Signed a -> Bool #

max :: Signed a -> Signed a -> Signed a #

min :: Signed a -> Signed a -> Signed a #

Real a => Real (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

toRational :: Signed a -> Rational #

RealFloat a => RealFloat (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

RealFrac a => RealFrac (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

properFraction :: Integral b => Signed a -> (b, Signed a) #

truncate :: Integral b => Signed a -> b #

round :: Integral b => Signed a -> b #

ceiling :: Integral b => Signed a -> b #

floor :: Integral b => Signed a -> b #

Show a => Show (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

showsPrec :: Int -> Signed a -> ShowS #

show :: Signed a -> String #

showList :: [Signed a] -> ShowS #

Semigroup a => Semigroup (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(<>) :: Signed a -> Signed a -> Signed a #

sconcat :: NonEmpty (Signed a) -> Signed a #

stimes :: Integral b => b -> Signed a -> Signed a #

Monoid a => Monoid (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

mempty :: Signed a #

mappend :: Signed a -> Signed a -> Signed a #

mconcat :: [Signed a] -> Signed a #

Bits a => Bits (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(.&.) :: Signed a -> Signed a -> Signed a #

(.|.) :: Signed a -> Signed a -> Signed a #

xor :: Signed a -> Signed a -> Signed a #

complement :: Signed a -> Signed a #

shift :: Signed a -> Int -> Signed a #

rotate :: Signed a -> Int -> Signed a #

zeroBits :: Signed a #

bit :: Int -> Signed a #

setBit :: Signed a -> Int -> Signed a #

clearBit :: Signed a -> Int -> Signed a #

complementBit :: Signed a -> Int -> Signed a #

testBit :: Signed a -> Int -> Bool #

bitSizeMaybe :: Signed a -> Maybe Int #

bitSize :: Signed a -> Int #

isSigned :: Signed a -> Bool #

shiftL :: Signed a -> Int -> Signed a #

unsafeShiftL :: Signed a -> Int -> Signed a #

shiftR :: Signed a -> Int -> Signed a #

unsafeShiftR :: Signed a -> Int -> Signed a #

rotateL :: Signed a -> Int -> Signed a #

rotateR :: Signed a -> Int -> Signed a #

popCount :: Signed a -> Int #

NFData a => NFData (Signed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

rnf :: Signed a -> () #

DecodeWire (Signed Int32) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (Signed Int64) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value (Signed Int32))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value (Signed Int64))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (Signed Int32) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (Signed Int64) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value (Signed Int32))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value (Signed Int64))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

newtype Fixed a Source #

Fixed integers are stored in little-endian form without additional encoding.

Constructors

Fixed a 
Instances
Functor Fixed Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

fmap :: (a -> b) -> Fixed a -> Fixed b #

(<$) :: a -> Fixed b -> Fixed a #

Foldable Fixed Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

fold :: Monoid m => Fixed m -> m #

foldMap :: Monoid m => (a -> m) -> Fixed a -> m #

foldr :: (a -> b -> b) -> b -> Fixed a -> b #

foldr' :: (a -> b -> b) -> b -> Fixed a -> b #

foldl :: (b -> a -> b) -> b -> Fixed a -> b #

foldl' :: (b -> a -> b) -> b -> Fixed a -> b #

foldr1 :: (a -> a -> a) -> Fixed a -> a #

foldl1 :: (a -> a -> a) -> Fixed a -> a #

toList :: Fixed a -> [a] #

null :: Fixed a -> Bool #

length :: Fixed a -> Int #

elem :: Eq a => a -> Fixed a -> Bool #

maximum :: Ord a => Fixed a -> a #

minimum :: Ord a => Fixed a -> a #

sum :: Num a => Fixed a -> a #

product :: Num a => Fixed a -> a #

Traversable Fixed Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

traverse :: Applicative f => (a -> f b) -> Fixed a -> f (Fixed b) #

sequenceA :: Applicative f => Fixed (f a) -> f (Fixed a) #

mapM :: Monad m => (a -> m b) -> Fixed a -> m (Fixed b) #

sequence :: Monad m => Fixed (m a) -> m (Fixed a) #

Bounded a => Bounded (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

minBound :: Fixed a #

maxBound :: Fixed a #

Enum a => Enum (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

succ :: Fixed a -> Fixed a #

pred :: Fixed a -> Fixed a #

toEnum :: Int -> Fixed a #

fromEnum :: Fixed a -> Int #

enumFrom :: Fixed a -> [Fixed a] #

enumFromThen :: Fixed a -> Fixed a -> [Fixed a] #

enumFromTo :: Fixed a -> Fixed a -> [Fixed a] #

enumFromThenTo :: Fixed a -> Fixed a -> Fixed a -> [Fixed a] #

Eq a => Eq (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(==) :: Fixed a -> Fixed a -> Bool #

(/=) :: Fixed a -> Fixed a -> Bool #

Floating a => Floating (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

pi :: Fixed a #

exp :: Fixed a -> Fixed a #

log :: Fixed a -> Fixed a #

sqrt :: Fixed a -> Fixed a #

(**) :: Fixed a -> Fixed a -> Fixed a #

logBase :: Fixed a -> Fixed a -> Fixed a #

sin :: Fixed a -> Fixed a #

cos :: Fixed a -> Fixed a #

tan :: Fixed a -> Fixed a #

asin :: Fixed a -> Fixed a #

acos :: Fixed a -> Fixed a #

atan :: Fixed a -> Fixed a #

sinh :: Fixed a -> Fixed a #

cosh :: Fixed a -> Fixed a #

tanh :: Fixed a -> Fixed a #

asinh :: Fixed a -> Fixed a #

acosh :: Fixed a -> Fixed a #

atanh :: Fixed a -> Fixed a #

log1p :: Fixed a -> Fixed a #

expm1 :: Fixed a -> Fixed a #

log1pexp :: Fixed a -> Fixed a #

log1mexp :: Fixed a -> Fixed a #

Fractional a => Fractional (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(/) :: Fixed a -> Fixed a -> Fixed a #

recip :: Fixed a -> Fixed a #

fromRational :: Rational -> Fixed a #

Integral a => Integral (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

quot :: Fixed a -> Fixed a -> Fixed a #

rem :: Fixed a -> Fixed a -> Fixed a #

div :: Fixed a -> Fixed a -> Fixed a #

mod :: Fixed a -> Fixed a -> Fixed a #

quotRem :: Fixed a -> Fixed a -> (Fixed a, Fixed a) #

divMod :: Fixed a -> Fixed a -> (Fixed a, Fixed a) #

toInteger :: Fixed a -> Integer #

Num a => Num (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(+) :: Fixed a -> Fixed a -> Fixed a #

(-) :: Fixed a -> Fixed a -> Fixed a #

(*) :: Fixed a -> Fixed a -> Fixed a #

negate :: Fixed a -> Fixed a #

abs :: Fixed a -> Fixed a #

signum :: Fixed a -> Fixed a #

fromInteger :: Integer -> Fixed a #

Ord a => Ord (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

compare :: Fixed a -> Fixed a -> Ordering #

(<) :: Fixed a -> Fixed a -> Bool #

(<=) :: Fixed a -> Fixed a -> Bool #

(>) :: Fixed a -> Fixed a -> Bool #

(>=) :: Fixed a -> Fixed a -> Bool #

max :: Fixed a -> Fixed a -> Fixed a #

min :: Fixed a -> Fixed a -> Fixed a #

Real a => Real (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

toRational :: Fixed a -> Rational #

RealFloat a => RealFloat (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

RealFrac a => RealFrac (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

properFraction :: Integral b => Fixed a -> (b, Fixed a) #

truncate :: Integral b => Fixed a -> b #

round :: Integral b => Fixed a -> b #

ceiling :: Integral b => Fixed a -> b #

floor :: Integral b => Fixed a -> b #

Show a => Show (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

showsPrec :: Int -> Fixed a -> ShowS #

show :: Fixed a -> String #

showList :: [Fixed a] -> ShowS #

Semigroup a => Semigroup (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(<>) :: Fixed a -> Fixed a -> Fixed a #

sconcat :: NonEmpty (Fixed a) -> Fixed a #

stimes :: Integral b => b -> Fixed a -> Fixed a #

Monoid a => Monoid (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

mempty :: Fixed a #

mappend :: Fixed a -> Fixed a -> Fixed a #

mconcat :: [Fixed a] -> Fixed a #

Bits a => Bits (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

(.&.) :: Fixed a -> Fixed a -> Fixed a #

(.|.) :: Fixed a -> Fixed a -> Fixed a #

xor :: Fixed a -> Fixed a -> Fixed a #

complement :: Fixed a -> Fixed a #

shift :: Fixed a -> Int -> Fixed a #

rotate :: Fixed a -> Int -> Fixed a #

zeroBits :: Fixed a #

bit :: Int -> Fixed a #

setBit :: Fixed a -> Int -> Fixed a #

clearBit :: Fixed a -> Int -> Fixed a #

complementBit :: Fixed a -> Int -> Fixed a #

testBit :: Fixed a -> Int -> Bool #

bitSizeMaybe :: Fixed a -> Maybe Int #

bitSize :: Fixed a -> Int #

isSigned :: Fixed a -> Bool #

shiftL :: Fixed a -> Int -> Fixed a #

unsafeShiftL :: Fixed a -> Int -> Fixed a #

shiftR :: Fixed a -> Int -> Fixed a #

unsafeShiftR :: Fixed a -> Int -> Fixed a #

rotateL :: Fixed a -> Int -> Fixed a #

rotateR :: Fixed a -> Int -> Fixed a #

popCount :: Fixed a -> Int #

NFData a => NFData (Fixed a) Source # 
Instance details

Defined in Data.ProtocolBuffers.Types

Methods

rnf :: Fixed a -> () #

DecodeWire (Fixed Int32) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (Fixed Int64) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (Fixed Word32) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (Fixed Word64) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value (Fixed Int32))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value (Fixed Int64))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value (Fixed Word32))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

DecodeWire (PackedList (Value (Fixed Word64))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (Fixed Int32) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

Methods

encodeWire :: Tag -> Fixed Int32 -> Put Source #

EncodeWire (Fixed Int64) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

Methods

encodeWire :: Tag -> Fixed Int64 -> Put Source #

EncodeWire (Fixed Word32) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (Fixed Word64) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value (Fixed Int32))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value (Fixed Int64))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value (Fixed Word32))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire

EncodeWire (PackedList (Value (Fixed Word64))) Source # 
Instance details

Defined in Data.ProtocolBuffers.Wire