Safe Haskell | None |
---|---|
Language | Haskell98 |
This module provides a less verbose API for accessing the options
of the various descriptor messages types. There are seven
different option types. The EnumValueOptions are not currently
settable in the proto file. To access extension keys the
descendKey functions are provided as the descend functions ignore
them. The toDP
, toEP
, toSP
are type-specific descents that
are demonstrated in the the tests below. They are useful in that
they provide more information for the type-checker. The toFP
,
toEVP
, and toMP
are fully type-specific descents but are
needed to make the tests below type-check, though they could have
been used in test4
, test5', and test7
.
import Text.DescriptorProtos.Options import Text.DescriptorProtos(fileDescriptorProto) test1 :: D.FileOptions test1 = options fileDescriptorProto test2 :: Maybe D.MessageOptions test2 = return fileDescriptorProto >>= descend "FieldDescriptorProto" >>= return . options test3 :: Maybe D.EnumOptions test3 = return fileDescriptorProto >>= toDP "FieldDescriptorProto" >>= descend "Type" >>= return . options test4 :: Maybe D.EnumValueOptions test4 = return fileDescriptorProto >>= toDP "FieldDescriptorProto" >>= toEP "Type" >>= descend "TYPE_DOUBLE" >>= return . options test5 :: Maybe D.FieldOptions test5 = return fileDescriptorProto >>= toDP "DescriptorProto" >>= toDP "ExtensionRange" >>= descend "start" >>= return . options test6 :: Maybe D.ServiceOptions test6 = return fileDescriptorProto >>= descend "ImaginaryService" >>= return . options test7 :: Maybe D.MethodOptions test7 = return fileDescriptorProto >>= toSP "ImaginaryService" >>= descend "ImaginaryMethod" >>= return . options
Documentation
descendKey :: DescendKey a => String -> a -> Maybe FieldDescriptorProto Source #
toDP :: DescendClass a DescriptorProto => String -> a -> Maybe DescriptorProto Source #
toEP :: DescendClass a EnumDescriptorProto => String -> a -> Maybe EnumDescriptorProto Source #
toFP :: String -> DescriptorProto -> Maybe FieldDescriptorProto Source #
class NameAndOptions a opt | a -> opt, opt -> a where Source #
Instances
class DescendClass a c where Source #
Instances
class DescendKey a where Source #
descendKey' :: a -> Utf8 -> Maybe FieldDescriptorProto Source #
Instances
DescendKey DescriptorProto Source # | |
Defined in Text.DescriptorProtos.Options | |
DescendKey FileDescriptorProto Source # | |
Defined in Text.DescriptorProtos.Options |
data FileDescriptorProto Source #
Instances
data DescriptorProto Source #
Instances
data EnumDescriptorProto Source #
Instances
data EnumValueDescriptorProto Source #
Instances
data FieldDescriptorProto Source #
Instances
data ServiceDescriptorProto Source #
Instances
data MethodDescriptorProto Source #
Instances
data EnumOptions Source #
Instances
data EnumValueOptions Source #
Instances
data FieldOptions Source #
Instances
data FileOptions Source #
Instances
data MessageOptions Source #
Instances
data MethodOptions Source #
Instances
data ServiceOptions Source #