l!      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~      ;7 is supposed to allow the execution of the monad to be > halted, awaiting more input. The computation is supposed to A continue normally if this returns True, and is supposed to halt B without calling suspend again if this returns False. All future A calls to suspend will return False automatically and no nothing  else. DThese semantics are too specialized to let this escape this module.   !"#$% &'( runs the todo" action and then rewinds only the ) BinaryParser state. Any new input from  or changes from  3 are kept. Changes to the user state (MonadState) 0 are kept. The MonadWriter output is retained. CIf an error is thrown then the entire monad state is reset to last  catchError as usual.  runs the todo action. If the action returns ) then the & BinaryParser state is rewound (as in ). If the action return * then F the BinaryParser is not rewound, and lookAheadM acts as an identity. CIf an error is thrown then the entire monad state is reset to last  catchError as usual.  runs the todo action. If the action returns + then the & BinaryParser state is rewound (as in ). If the action return , then F the BinaryParser is not rewound, and lookAheadE acts as an identity. CIf an error is thrown then the entire monad state is reset to last  catchError as usual. - is the simple executor 1Get the input currently available to the parser. * replaces the bytestream past the current # of read > bytes. This will also affect pending MonadError handler and @ MonadPlus branches. I think all pending branches have to have A fewer bytesRead than the current one. If this is wrong then an  error will be thrown.  WARNING :  is still untested. ./ Keep calling  until Nothing is passed to the   C continuation. This ensures all the data has been loaded into the  state of the parser. 03Call suspend and throw and error with the provided msg if  Nothing has been passed to the   continuation. Otherwise  return (). check that there are at least n bytes available in the input. / This will suspend if there is to little data. Pull n8 bytes from the unput, as a lazy ByteString. This will & suspend if there is too little data. 11) causes the most recent catchError to be F discarded, i.e. this reduces the stack of error handlers by removing > the top one. These are the same handlers which Alternative(( |)) and O MonadPlus(mplus) use. This is useful to commit to the current branch and let E the garbage collector release the suspended handler and its hold on  the earlier input. Discard the next m bytes Return the number of ' so far. Initially 0, never negative. Return the number of bytes  before the current input  runs out and  might be called. #Return True if the number of bytes  is 0. Any futher , attempts to read an empty parser will call  which might " result in more input to consume.  Compare with  BReturn True if the input is exhausted and will never be added to. 2 Returns False if there is input left to consume.  Compare with  Pull n: bytes from the input, as a strict ByteString. This will D suspend if there is too little data. If the result spans multiple A lazy chunks then the result occupies a freshly allocated strict C bytestring, otherwise it fits in a single chunk and refers to the 1 same immutable memory block as the whole chunk.  !"#$%&'()2I use splitAt= without tolerating too few bytes, so write a Maybe version. U This is the only place I invoke L.Chunk as constructor instead of pattern matching. 2 I claim that the first argument cannot be empty. 3*456!  !"#$%&'()*!   * !$'"%(#&)!   !"#$%&'()*+The +6 class is for internal use, and may change. If there  is a mis-match between the :9 and the type of b then you  will get a failure at runtime. 7Users 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. ,-./@The Default class has the default-default values of types. See   Dhttp://code.google.com/apis/protocolbuffers/docs/proto.html#optional  and also note that 7 types have a 0 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. 0 is where the   MessageAPI function getVal% looks when an optional field is not  set. 0The 0, is never undefined or an error to evalute. , This makes it much more useful compared to 2. In a 6 default message all Optional field values are set to ) & and Repeated field values are empty. 1The 1 class is not a 8, 2 is not a  left or right unit like 9. The default 3 is to ; take the second parameter and discard the first one. The  4 defaults to foldl associativity. 2The 2) value of a basic type or a message with : required fields will be undefined and a runtime error to C evaluate. These are only handy for reading the wire encoding and  users should employ 0 instead. 33- is the right-biased merge of two values. A ? message (or group) is merged recursively. Required field are A always taken from the second message. Optional field values are ? taken from the most defined message or the message message if A both are set. Repeated fields have the sequences concatenated. 3 Note that strings and bytes are NOT concatenated. 44 is  F.foldl mergeAppend mergeEmpty  and this 9 default definition is not overrring in any of the code. 550 is the Int64 size type associate with the lazy  bytestrings used in the  and   monads. 676 is the Int32 assoicated with a ; EnumValueDescriptorProto and is in the range 0 to 2^31-1. 789:9$ is the integer associated with the  FieldDescriptorProto'-s Type. The allowed range is currently 1 to 4 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; H TYPE_INT64 = 3; // Not ZigZag encoded. Negative numbers N // take 10 bytes. Use TYPE_SINT64 if negative 5 // values are likely.  TYPE_UINT64 = 4; H TYPE_INT32 = 5; // Not ZigZag encoded. Negative numbers N // take 10 bytes. Use TYPE_SINT32 if negative 5 // 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; 8 TYPE_SINT32 = 17; // Uses ZigZag encoding. 8 TYPE_SINT64 = 18; // Uses ZigZag encoding. :;<=<7 is the 3 bit wire encoding value, and is currently in 6 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 =>?@?4 is the field number which can be in the range 1 to C 2^29-1 but the value from 19000 to 19999 are forbidden (so sayeth  Google). @ABCB6 is the 32 bit value with the upper 29 bits being the  @? and the lower 3 bits being the =< CDEFE is used to mark  values that (should) contain = valud utf8 encoded strings. This type is used to represent   TYPE_STRING values. FG# +,-./0123456789:;<=>?@ABCDEFG# EFGBCD?@A<=>9:;67851234/0+,-.+,-.,-./0012342345678789:;:;<=>=>?@A@ABCDCDEFGFGFHThe I7 transformation has instances for several combiantions F of input and output. These allow one to construct the Haskell types  of MNameFMNamePMName and FNameFFNamePFName out of the protobuf  types INameDIName.FIName. Currently, all the Haskell instances  are for the String base type. IJ>This is used to abstract over Utf8 and String. The important  entry point is O. KLMNOO ensures the DIName is PP returns a list of non-empty a with all : characters removed QAParsed Haskell name ending with FName. Good constructor to use. RS@Parsed Haskell name ending with MName. Good contructor to use. TU-Full Haskell field name: MNames separated by :, ending with a field VWX.Full Haskell module name: MNames separated by :, ending with a module YZ[&Fully qualified identifier: repeated (: then identifier) \]^:@ separated identifier which may or may start with a dot. There  are never two or more :6s in a row. There is always at least one identifier. _`a#Contains one field name, non-empty bcd$Contains one module name, non-empty efgContains one identifier name hijkl;<=>mnoo examines the _^ and prepend a : if absent, promoting  it to a \[. pTyped P qTyped P rTyped P stuvwxyz,Right (True,_) means the input is a FIName. > Right (False,_) means the input is a DIName (without leading :) 1This creates useful error messages for the user. {,Right (True,_) means the input is a FIName. > Right (False,_) means the input is a DIName (without leading :) 1This creates useful error messages for the user. ?@A'Return list of nonempty Utf8, with all : removed B)Return list of nonempty String, with all : removed CDEFGHIJKLL4 is a set of strings which are Haskell keywords and " should not be valid field names. I do not protect these values:  mdo,foreign,rec,proc ( GHC manual section 8.3.16 ) E because I do not anticipate using these extensions in the generated  Haskell code. 4HIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{4jklghi^_`[\]defXYZSTabcUVWQRJKLMNOPHImnopqrz{stuvwxy4HIIJKLMNOPKLMNOPQRRSTTUVWVWXYZYZ[\]\]^_`_`abcbcdefefghihijklmnopqrstuvwxyz{D|}This is obtained via M on the stored N output of the  in @ the module file. It is used in getting messages from the wire. Must not inspect argument ~Must not inspect argument Must not inspect argument Must not inspect argument 4 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. ANote that Utf8 labeled byte sequences have been stripped to just  1 here as this is sufficient for code generation. /Bytes required in the Varint formatted wireTag <fromEnum of Text.DescriptorProtos.FieldDescriptorProto.Type "Set for Messages,Groups,and Enums crappy, but not escaped, thing nice parsed thing 0 is used in getting messages from the wire. It  supplies the O0 of precomposed wire tags that must be found in  the message as well as a O& of all allowed tags (including known / extension fields and all required wire tags). BExtension fields not in the allowedTags set are still loaded, but  only as , blobs that will have to interpreted later. 1blank protobufName, maybe blank haskellPrefix and/or parentModule path to haskell module %filename without path of .proto file top level keys all messages and groups  all enums fully qualified name using package prefix (no mangling) <Haskell specific prefix to module hierarchy (e.g. Text.Foo) 1.proto specified namespace (like Com.Google.Bar) AThis is fully qualified name data type for code generation. The   was possibly specified on the hprotoc command  line. The ' is a combination of the module prefix  from the '.proto'+ file and any nested levels of definition. BThe name components are likely to have been mangled to ensure the  & started with an uppercase letter, in  ['A'..'Z'] . fully qualified name using package prefix (no mangling) <Haskell specific prefix to module hierarchy (e.g. Text.Foo) 1.proto specified namespace (like Com.Google.Bar) N is used by the generated code to create a ProtoName with less newtype noise. D|}~D|}~D|}~}~   P2%This computes the size of the message's fields with tags on the B wire with no initial tag or length (in bytes). This is also the D length of the message as placed between group start and stop tags. 3This computes the size of the message fields as in  D and add the length of the encoded size to the total. Thus this is D the the length of the message including the encoded length header,  but without any leading tag. This computes the size of the  and then / adds the length an initial tag with the given @?. This is  applied to . It result in a   with a length of  bytes. This is  applied to . It results  in a  with a length of  bytes. This writes just the message'&s fields with tags to the wire. This  4 monad can be composed and eventually executed with . This is actually  wirePut 10 msg  -This writes the encoded length of the message's fields and then  the message'&s fields with tags to the wire. This  monad can + be composed and eventually executed with . This is actually  wirePut 11 msg  /This writes an encoded wire tag with the given @? and then # the encoded length of the message's fields and then the message's & fields with tags to the wire. This  monad can be composed  and eventually executed with . This consumes the " to decode a message. It assumes  the 2 is merely a sequence of the tagged fields of the A message, and consumes until a group stop tag is detected or the  entire input is consumed. Any  past the end of the  stop tag is returned as well. This is  applied to . This  applied to . AThis first reads the encoded length of the message and will then D succeed when it has consumed precisely this many additional bytes.  The $ after this point will be returned. ?This reads the tagged message fields until the stop tag or the  end of input is reached. This is actually  wireGet 10 msg  <This reads the encoded message length and then the message. This is actually  wireGet 11 msg  'This reads a wire tag (must be of type '2' ) to get the @?. B Then the encoded message length is read, followed by the message  itself. Both the @? and the message are returned. 4This allows for incremental reading and processing. This is  with the + results converted to  Q calls and the trailing  discarded. This use of 7 runtime errors is discouraged, but may be convenient. Used in generated code. Used in generated code. Used in generated code. Used in generated code. Used in generated code. Used in generated code. Used in generated code. Used in generated code. Used by generated code Used by generated code [ getBareMessage assumes the wireTag for the message, if it existed, has already been read. ] getBareMessage assumes that it does needs to read the Varint encoded length of the message. S getBareMessage will consume the entire ByteString it is operating on, or until it  finds any STOP_GROUP tag RAThis reads in the raw bytestring corresponding to an field known  only through the wiretag's @? and =<. S'After a group start tag with the given @? this will skip > ahead in the stream past the end tag of that group. Used by  0 to help compule the length of an unknown field  when loading an extension. 9 +,-.9 +,-.00<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 9 it is set or lookup the default value if it is not set. 9 The field name of a repeated field always retrieves the  (possibly empty)   of values. ? A Key for an optional or repeated value will act as the field A 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 T. 4 Optional fields return whether a value is present.  Repeated field return U# if there are no values, otherwise  they return T. = Keys return as optional or repeated, but checks only if the  field #8 is present. This assumes that there are no collisions A where more that one key refers to the same field number of this  message type. The  and VW GADTs use  as a shorthand for many  classes. The 0 class has three functions for user of the API:  , , and . The  is used in  generated code. 'There are two instances of this class, X for optional message  fields and  1 for repeated message fields. This class allows ? for uniform treatment of these two kinds of extension fields. 9Change or clear the value of a key in a message. Passing  )" with an optional key or an empty   with a repeated C key clears the value. This function thus maintains the invariant # that having a field number in the  map means that the  field is set and not empty. BThis should be only way to set the contents of a extension field. 3Access 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: 6 It may find unparsed bytes from loading the message.  , will attempt to parse the bytes as the key's value type, and * may fail. The parsing is done with the  parseWireExt method ' (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. ) abstracts the operations of storing and  retrieving the $ from the message, and provides the 4 reflection needed to know the valid field numbers. This only used internally. ExtField is a newtype'*d map from the numeric FieldId key to the = ExtFieldValue. This allows for the needed class instances. Y6The WireType is used to ensure the Seq is homogenous. 5 The ByteString is the unparsed input after the tag. ! The WireSize includes all tags. ZThe [Z is another specialization of Dynamic and is used  in  for repeated fields. [\The ]\ is my specialization of Dynamic. It hides the type  with an existential but the VW brings the class instances  into scope. This is used in  for optional fields. ]WVW is an instance witness for the  classes. This  exists mainly to be a part of ]\ or [Z. VThe  data type is used with the  class to put, get, - and clear external fields of messages. The  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 7 type (opaque to the user) has a phantom type of Maybe ? or Seq that corresponds to Optional or Repeated fields. And a C second phantom type that matches the message type it must be used A with. The third type parameter corresonds to the Haskell value  type. The 9 is a GADT that puts all the needed class instances into # scope. The actual content is the @? ( numeric key), the  :9 (for sanity checks), and Maybe v (a non-standard  default value). DWhen code is generated all of the known keys are taken into account E 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. BThere is no guarantee for what happens if two Keys disagree about B the type of a field; in particular there may be undefined values / and runtime errors. The data constructor for  has to be C exported to the generated code, but is not exposed to the user by  Text.ProtocolBuffers. ^<This allows reflection, in this case it gives the numerical  @?8 of the key, from 1 to 2^29-1 (excluding 19,000 through  19,999). 2This allows reflection, in this case it gives the :9 $ enumeration value (1 to 18) of the  /Text.DescriptorProtos.FieldDescriptorProto.Type of the field. /This will return the default value for a given  , which is  set in the '.proto' file, or if unset it is the 0 of  that type. _`abcdefused by  and  for the X instance gConverts the the   into an h type and enforces  consumption of entire  . Used by f  and i) to process raw wire input that has been  stored in an . iused by  and  for the   instance #This is used by the generated code  >This is used by the generated code. The data is serialized in # order of increasing field number.  HThis is used by the generated code to get messages that have extensions  HThis is used by the generated code to get messages that have extensions jj is used by  extension to check whether the field 0 number is in one of the ranges declared in the '.proto' file.  *get a value from the wire into the message's ExtField. This is  used by   and   above.               kl#This is used by the generated code #This is used by the generated code       mnopqrstuvwxyz{|}~ +,-./0123456789:;<=>?@ABCDEFG[\]abcdef|}~      +/01234569<?BEGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~     !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLLMNNOPPQRRSTTUVVWXYZ[\]^_`aabbccdeefgghiijkklmmnoopqrstuvwxyz{|}~        !"# $% $& '( ')*+,-./0123 45 67 68 9:;<=>?@ABCDEFGHIJKL MN OPQR S TUVWXYZXY[\\ $]^__``Iabcdefghi 'jklIm no pq nr ns nt nu nv nw nx ny nz n{ n| n} n~ n  pprotocol-buffers-1.0.0Text.ProtocolBuffers.Basic Text.ProtocolBuffers.WireMessageText.ProtocolBuffers.HeaderText.ProtocolBuffers.Get Text.ProtocolBuffers.Identifiers Text.ProtocolBuffers.ReflectionsText.ProtocolBuffers.ExtensionsText.ProtocolBuffers.UnknownText.ProtocolBuffers.DefaultText.ProtocolBuffers.MergeableText.ProtocolBuffersbaseGHC.IntInt32Int64GHC.WordWord32Word64bytestring-0.9.1.7Data.ByteString.Lazy.Internal ByteStringbinary-0.5.0.2Data.Binary.PutputLazyByteStringrunPutPutData.ByteString.Lazy.Char8packcontainers-0.3.0.0 Data.SequenceSeqGetResultPartialFinishedFailed lookAhead lookAheadM lookAheadErunGet getAvailable putAvailablesuspendUntilComplete ensureBytesgetLazyByteStringskip bytesRead remainingisEmpty isReallyEmptyspanOf getByteString getWordhostgetWord8 getWord16be getWord16le getWord16host getWord32be getWord32le getWord32host getWord64be getWord64le getWord64host getStorableWirewireSizewirePutwireGetDefault defaultValue Mergeable mergeEmpty mergeAppend mergeConcatWireSizeEnumCode getEnumCode FieldType getFieldTypeWireType getWireTypeFieldId getFieldIdWireTag getWireTagUtf8utf8ManglemangleDottedunconsconsdotvalidIvalidDIsplitPFNamePMNameFFNameffNameFMNamefmNameFINamefiNameDINamediNameFNamefNameMNamemNameINameiNameunulltoString fromStringjoinPMjoinPFdifisplitDIsplitFIsplitFM promoteDI promoteFI promoteFM promoteFFdotFMdotFFfqAppend checkDIString checkDIUtf8ReflectDescriptorgetMessageInforeflectDescriptorInfo ReflectEnum reflectEnumreflectEnumInfo parentOfEnum EnumInfoAppEnumInfoenumName enumFilePath enumValues HsDefault HsDef'Enum HsDef'IntegerHsDef'RationalHsDef'ByteString HsDef'Bool FieldInfo fieldName fieldNumberwireTag wireTagLength isRequired canRepeattypeCodetypeName hsRawDefault hsDefaultKeyInfoGetMessageInfo requiredTags allowedTagsDescriptorInfodescName descFilePathisGroupfieldskeys extRanges knownKeys storeUnknown ProtoInfoprotoMod protoFilePath protoSource extensionKeysmessagesenums knownKeyMap ProtoFName protobufName'haskellPrefix' parentModule' baseName' ProtoName protobufName haskellPrefix parentModulebaseNamemakePNF messageSizemessageWithLengthSizemessageAsFieldSize messagePutmessageWithLengthPut messagePutMmessageWithLengthPutMmessageAsFieldPutM messageGetmessageWithLengthGet messageGetMmessageWithLengthGetMmessageAsFieldGetM getFromBS runGetOnLazyprependMessageSize wirePutReq wirePutOpt wirePutRep wireSizeReq wireSizeOpt wireSizeRepputSize toWireTag mkWireTag splitWireTag getMessagegetMessageWithunknowngetBareMessagegetBareMessageWith unknownFieldcastWord32ToFloatcastFloatToWord32castWord64ToDoublecastDoubleToWord64 wireSizeErr wirePutErr wireGetErr size'Varint zzEncode32 zzEncode64 zzDecode32 zzDecode64 getVarInt putVarUIntwireGetFromWire toWireType MessageAPIgetValisSetGPBExtKeyputExtgetExtclearExt wireGetKey ExtendMessage getExtField putExtFieldvalidExtRangesExtField ExtFieldValue ExtRepeated ExtOptional ExtFromWireKey getKeyFieldIdgetKeyFieldTypegetKeyDefaultValuewireSizeExtFieldwirePutExtField getMessageExtgetBareMessageExt loadExtensionUnknownFieldValueUFV UnknownFieldUnknownMessagegetUnknownFieldputUnknownFieldwireSizeUnknownFieldwirePutUnknownField loadUnknownappendemptyBS MonadSuspendsuspendunGetSuccess FrameStack HandlerFrame ErrorFrameStopcurrentconsumed setCheckpoint useCheckpointclearCheckpoint Data.MaybeNothingJust Data.EitherLeftRightcollectgetFullputFull suspendMsgdiscardInnerHandler splitAtOrDiegetPtr shiftl_w16 shiftl_w32 shiftl_w64GHC.EnumEnum Data.MonoidMonoidmemptyGHC.Base.app_precmax_precreadItshowItdotUtf8 dotString splitUtf8 splitString validIUtf8 validIString validDIUtf8 validDIString validISet validDISeterrfixUpfixLowreserved Text.ReadreadGHC.ShowshowData.SetSetmayMergeGHC.Errerror putVarSInt skipGroupghc-primGHC.BoolTrueFalse GPWitnessMaybeDummyMessageTypeGPDynSeqGPDynmergeExtFieldValue gpWitnessC gpWitnessDTordGPDyneqGPDyn ordGPDynSeq eqGPDynSeqparseWireExtMaybeapplyGetEitherparseWireExtSeq isValidExtmergeUnknownFieldValue Data.DataData Data.TypeableTypeablegmapMogmapMpgmapMgmapQigmapQgmapQrgmapQlgmapT dataCast2 dataCast1 dataTypeOftoConstrgunfoldgfoldl Control.MonadaptypeOf