Safe Haskell | None |
---|---|
Language | Haskell98 |
- data Double :: *
- data Float :: *
- data Bool :: *
- data Maybe a :: * -> *
- data Seq a :: * -> *
- newtype Utf8 = Utf8 ByteString
- data ByteString :: *
- data Int32 :: *
- data Int64 :: *
- data Word32 :: *
- data Word64 :: *
- newtype WireTag = WireTag {
- getWireTag :: Word32
- newtype FieldId = FieldId {
- getFieldId :: Int32
- newtype WireType = WireType {}
- newtype FieldType = FieldType {
- getFieldType :: Int
- newtype EnumCode = EnumCode {
- getEnumCode :: Int32
- type WireSize = Int64
- class Default a => Mergeable a where
- class Default a where
- isValidUTF8 :: ByteString -> Maybe Int
- toUtf8 :: ByteString -> Either Int Utf8
- utf8 :: Utf8 -> ByteString
- uToString :: Utf8 -> String
- uFromString :: String -> Utf8
Basic types for protocol buffer fields in Haskell
Double-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE double-precision type.
Eq Double | |
Floating Double | Since: 2.1 |
Data Double | Since: 4.0.0.0 |
Ord Double | |
Read Double | Since: 2.1 |
RealFloat Double | Since: 2.1 |
PrintfArg Double | Since: 2.1 |
Storable Double | Since: 2.1 |
Default Double Source # | |
Mergeable Double Source # | |
TextType Double Source # | |
Wire Double Source # | |
GPB Double Source # | |
IArray UArray Double | |
Generic1 k (URec k Double) | |
MessageAPI msg (msg -> Double) Double Source # | |
MArray (STUArray s) Double (ST s) | |
Functor (URec * Double) | |
Foldable (URec * Double) | |
Traversable (URec * Double) | |
Eq (URec k Double p) | |
Ord (URec k Double p) | |
Show (URec k Double p) | |
Generic (URec k Double p) | |
data URec k Double | Used for marking occurrences of Since: 4.9.0.0 |
type Rep1 k (URec k Double) | |
type Rep (URec k Double p) | |
Single-precision floating point numbers. It is desirable that this type be at least equal in range and precision to the IEEE single-precision type.
Eq Float | |
Floating Float | Since: 2.1 |
Data Float | Since: 4.0.0.0 |
Ord Float | |
Read Float | Since: 2.1 |
RealFloat Float | Since: 2.1 |
PrintfArg Float | Since: 2.1 |
Storable Float | Since: 2.1 |
Default Float Source # | |
Mergeable Float Source # | |
TextType Float Source # | |
Wire Float Source # | |
GPB Float Source # | |
IArray UArray Float | |
Generic1 k (URec k Float) | |
MessageAPI msg (msg -> Float) Float Source # | |
MArray (STUArray s) Float (ST s) | |
Functor (URec * Float) | |
Foldable (URec * Float) | |
Traversable (URec * Float) | |
Eq (URec k Float p) | |
Ord (URec k Float p) | |
Show (URec k Float p) | |
Generic (URec k Float p) | |
data URec k Float | Used for marking occurrences of Since: 4.9.0.0 |
type Rep1 k (URec k Float) | |
type Rep (URec k Float p) | |
Bounded Bool | Since: 2.1 |
Enum Bool | Since: 2.1 |
Eq Bool | |
Data Bool | Since: 4.0.0.0 |
Ord Bool | |
Read Bool | Since: 2.1 |
Show Bool | |
Ix Bool | Since: 2.1 |
Generic Bool | |
SingKind Bool | Since: 4.9.0.0 |
Storable Bool | Since: 2.1 |
Bits Bool | Interpret Since: 4.7.0.0 |
FiniteBits Bool | Since: 4.7.0.0 |
Default Bool Source # | |
Mergeable Bool Source # | |
TextType Bool Source # | |
Wire Bool Source # | |
GPB Bool Source # | |
IArray UArray Bool | |
SingI Bool False | Since: 4.9.0.0 |
SingI Bool True | Since: 4.9.0.0 |
MArray (STUArray s) Bool (ST s) | |
type Rep Bool | |
data Sing Bool | |
type DemoteRep Bool | |
type (==) Bool a b | |
The Maybe
type encapsulates an optional value. A value of type
either contains a value of type Maybe
aa
(represented as
),
or it is empty (represented as Just
aNothing
). Using Maybe
is a good way to
deal with errors or exceptional cases without resorting to drastic
measures such as error
.
The Maybe
type is also a monad. It is a simple kind of error
monad, where all errors are represented by Nothing
. A richer
error monad can be built using the Either
type.
Monad Maybe | Since: 2.1 |
Functor Maybe | Since: 2.1 |
Applicative Maybe | Since: 2.1 |
Foldable Maybe | Since: 2.1 |
Traversable Maybe | Since: 2.1 |
Eq1 Maybe | Since: 4.9.0.0 |
Ord1 Maybe | Since: 4.9.0.0 |
Read1 Maybe | Since: 4.9.0.0 |
Show1 Maybe | Since: 4.9.0.0 |
Alternative Maybe | Since: 2.1 |
MonadPlus Maybe | Since: 2.1 |
ExtKey Maybe Source # | |
(Default msg, Default a) => MessageAPI msg (msg -> Maybe a) a Source # | |
Default v => MessageAPI msg (Key Maybe msg v) v Source # | |
Eq a => Eq (Maybe a) | |
Data a => Data (Maybe a) | Since: 4.0.0.0 |
Ord a => Ord (Maybe a) | |
Read a => Read (Maybe a) | Since: 2.1 |
Show a => Show (Maybe a) | |
Generic (Maybe a) | |
Semigroup a => Semigroup (Maybe a) | Since: 4.9.0.0 |
Monoid a => Monoid (Maybe a) | Lift a semigroup into Since: 2.1 |
SingKind a => SingKind (Maybe a) | Since: 4.9.0.0 |
Default (Maybe a) Source # | |
Mergeable a => Mergeable (Maybe a) Source # | |
TextType a => TextType (Maybe a) Source # | |
Generic1 * Maybe | |
SingI (Maybe a) (Nothing a) | Since: 4.9.0.0 |
SingI a1 a2 => SingI (Maybe a1) (Just a1 a2) | Since: 4.9.0.0 |
type Rep (Maybe a) | |
data Sing (Maybe a) | |
type DemoteRep (Maybe a) | |
type Rep1 * Maybe | |
type (==) (Maybe k) a b | |
General-purpose finite sequences.
Monad Seq | |
Functor Seq | |
Applicative Seq | |
Foldable Seq | |
Traversable Seq | |
Eq1 Seq | |
Ord1 Seq | |
Read1 Seq | |
Show1 Seq | |
MonadZip Seq | |
Alternative Seq | |
MonadPlus Seq | |
UnzipWith Seq | |
ExtKey Seq Source # | |
MessageAPI msg (msg -> Seq a) (Seq a) Source # | |
Default v => MessageAPI msg (Key Seq msg v) (Seq v) Source # | |
IsList (Seq a) | |
Eq a => Eq (Seq a) | |
Data a => Data (Seq a) | |
Ord a => Ord (Seq a) | |
Read a => Read (Seq a) | |
Show a => Show (Seq a) | |
IsString (Seq Char) | |
Semigroup (Seq a) | |
Monoid (Seq a) | |
NFData a => NFData (Seq a) | |
Default (Seq a) Source # | |
Mergeable (Seq a) Source # | |
TextType a => TextType (Seq a) Source # | |
type Item (Seq a) | |
Utf8
is used to mark ByteString
values that (should) contain
valid utf8 encoded strings. This type is used to represent
TYPE_STRING
values.
Eq Utf8 Source # | |
Data Utf8 Source # | |
Ord Utf8 Source # | |
Read Utf8 Source # | |
Show Utf8 Source # | |
Semigroup Utf8 Source # | |
Monoid Utf8 Source # | |
Default Utf8 Source # | |
Mergeable Utf8 Source # | |
Dotted Utf8 Source # | |
TextType Utf8 Source # | |
Wire Utf8 Source # | |
GPB Utf8 Source # | |
MessageAPI msg (msg -> Utf8) Utf8 Source # | |
Mangle (FIName Utf8) (PFName String) Source # | |
Mangle (FIName Utf8) (PMName String) Source # | |
Mangle (DIName Utf8) (PFName String) Source # | |
Mangle (DIName Utf8) (PMName String) Source # | |
Mangle (IName Utf8) (FName String) Source # | |
Mangle (IName Utf8) (MName String) Source # | |
data ByteString :: * #
A space-efficient representation of a Word8
vector, supporting many
efficient operations.
A lazy ByteString
contains 8-bit bytes, or by using the operations
from Data.ByteString.Lazy.Char8 it can be interpreted as containing
8-bit characters.
32-bit signed integer type
Bounded Int32 | Since: 2.1 |
Enum Int32 | Since: 2.1 |
Eq Int32 | Since: 2.1 |
Integral Int32 | Since: 2.1 |
Data Int32 | Since: 4.0.0.0 |
Num Int32 | Since: 2.1 |
Ord Int32 | Since: 2.1 |
Read Int32 | Since: 2.1 |
Real Int32 | Since: 2.1 |
Show Int32 | Since: 2.1 |
Ix Int32 | Since: 2.1 |
PrintfArg Int32 | Since: 2.1 |
Storable Int32 | Since: 2.1 |
Bits Int32 | Since: 2.1 |
FiniteBits Int32 | Since: 4.6.0.0 |
Default Int32 Source # | |
Mergeable Int32 Source # | |
TextType Int32 Source # | |
Wire Int32 Source # | |
GPB Int32 Source # | |
IArray UArray Int32 | |
MessageAPI msg (msg -> Int32) Int32 Source # | |
MArray (STUArray s) Int32 (ST s) | |
64-bit signed integer type
Bounded Int64 | Since: 2.1 |
Enum Int64 | Since: 2.1 |
Eq Int64 | Since: 2.1 |
Integral Int64 | Since: 2.1 |
Data Int64 | Since: 4.0.0.0 |
Num Int64 | Since: 2.1 |
Ord Int64 | Since: 2.1 |
Read Int64 | Since: 2.1 |
Real Int64 | Since: 2.1 |
Show Int64 | Since: 2.1 |
Ix Int64 | Since: 2.1 |
PrintfArg Int64 | Since: 2.1 |
Storable Int64 | Since: 2.1 |
Bits Int64 | Since: 2.1 |
FiniteBits Int64 | Since: 4.6.0.0 |
Default Int64 Source # | |
Mergeable Int64 Source # | |
TextType Int64 Source # | |
Wire Int64 Source # | |
GPB Int64 Source # | |
IArray UArray Int64 | |
MessageAPI msg (msg -> Int64) Int64 Source # | |
MArray (STUArray s) Int64 (ST s) | |
32-bit unsigned integer type
Bounded Word32 | Since: 2.1 |
Enum Word32 | Since: 2.1 |
Eq Word32 | Since: 2.1 |
Integral Word32 | Since: 2.1 |
Data Word32 | Since: 4.0.0.0 |
Num Word32 | Since: 2.1 |
Ord Word32 | Since: 2.1 |
Read Word32 | Since: 2.1 |
Real Word32 | Since: 2.1 |
Show Word32 | Since: 2.1 |
Ix Word32 | Since: 2.1 |
PrintfArg Word32 | Since: 2.1 |
Storable Word32 | Since: 2.1 |
Bits Word32 | Since: 2.1 |
FiniteBits Word32 | Since: 4.6.0.0 |
Default Word32 Source # | |
Mergeable Word32 Source # | |
TextType Word32 Source # | |
Wire Word32 Source # | |
GPB Word32 Source # | |
IArray UArray Word32 | |
MessageAPI msg (msg -> Word32) Word32 Source # | |
MArray (STUArray s) Word32 (ST s) | |
64-bit unsigned integer type
Bounded Word64 | Since: 2.1 |
Enum Word64 | Since: 2.1 |
Eq Word64 | Since: 2.1 |
Integral Word64 | Since: 2.1 |
Data Word64 | Since: 4.0.0.0 |
Num Word64 | Since: 2.1 |
Ord Word64 | Since: 2.1 |
Read Word64 | Since: 2.1 |
Real Word64 | Since: 2.1 |
Show Word64 | Since: 2.1 |
Ix Word64 | Since: 2.1 |
PrintfArg Word64 | Since: 2.1 |
Storable Word64 | Since: 2.1 |
Bits Word64 | Since: 2.1 |
FiniteBits Word64 | Since: 4.6.0.0 |
Default Word64 Source # | |
Mergeable Word64 Source # | |
TextType Word64 Source # | |
Wire Word64 Source # | |
GPB Word64 Source # | |
IArray UArray Word64 | |
MessageAPI msg (msg -> Word64) Word64 Source # | |
MArray (STUArray s) Word64 (ST s) | |
Haskell types that act in the place of DescritorProto values
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).
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
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.
EnumCode
is the Int32 assoicated with a
EnumValueDescriptorProto and is in the range 0 to 2^31-1.
type WireSize = Int64 Source #
WireSize
is the Int64 size type associated with the lazy
bytestrings used in the Put
and Get
monads.
Some of the type classes implemented messages and fields
class Default a => Mergeable a where Source #
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
.
mergeAppend :: a -> a -> a Source #
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 Source #
mergeConcat
is F.foldl mergeAppend defaultValue
and this
default definition is not overridden in any of the code except
for the (Seq a) instance.
class Default a where Source #
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.
defaultValue :: a Source #
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.
isValidUTF8 :: ByteString -> Maybe Int Source #
utf8 :: Utf8 -> ByteString Source #
uFromString :: String -> Utf8 Source #