4      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ (c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalSafe %&/0OQRTUsed when the   for something is not known at compile time. Typically, this will be pattern matched inside a case statement and code that depends on the TType will be go there.,Typeclass used to map type-leve TTypes into  6 objects. All TType tags are instances of this class.\Based on the context in which this is used, it will automatically return the corresponding   object. &Represents the type of a Thrift value.Objects of this type are tagged with one of the TType tags, so this type also acts as a singleton on the TTypes. It allows writing code that can enforce properties about the TType of values at compile time. list<x> set<x>  map<k, v>  exception union struct string binary i64 enum i32 i16! double" byte# bool$#Witness the equality of two ttypes.%#Witness the equality of two TTypes.Implicit version of  ttypeEquality.-  !"#$%&'()*+,-./01!  !"#$%! $%#"!    !"#$%&'()*+,-./01 (c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalSafeOT5#A simple continuation-based parser. This is just  Either e a in continuation-passing style.-Success continuation. Called with the result.6Failure continuation. Called with the failure message.6Run a Parser! and return the result inside an Either.7Allows handling parse errors. 567567 567(c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalSafe0OT8 FoldList represents a list as a foldl' traversal over it.This allows us to avoid allocating new collections for an intermediate representation of various data types that users provide.9/Builds a FoldList over pairs of items of a map.:"Builds a FoldList from a Foldable.;;Applies the given function to all elements in the FoldList.Note that the function is applied lazily when the results are requested. If the results of the same FoldList are requested multiple times, the function will be called multiple times on the same elements.<0Returns a FoldList with the given item repeated n times.=cExecutes the given monadic action the given number of times and returns a FoldList of the results.89 foldlWithKey$ provided by the map implementation.:;<=>?@ABCDE 89:;<= 8;<=:989:;<=>?@ABCDE(c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalSafe %&/0OQRTFF holds any value, regardless of type. This may be used when the type of the value is not necessarily known at compile time. Typically, this will be pattern matched on and code that depends on the value's  ' will go inside the scope of the match.HValue maps directly to serialized representation of Thrift types. It contains about as much information as what gets sent over the wire. Value# objects are tagged with different  + values to indicate the type of the value.JTypical usage will not involve accessing the constructors for this type.  must be used to construct H1 objects or convert them back to original types.UA single item in a mapW,Safely attempt to cast a Value into another.XGet the   of a H.!FGHIJKLMNOPQRSTUVWXYZ[\]^_`abFGHIJKLMNOPQRSTUVWXHIJKLMNOPQRSTUVFGWXFGH IJKLMNOPQRSTUVWXYZ[\]^_`ab(c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalSafe05 e%Message envelope for Thrift payloads.g5Name of the method to which this message is targeted.hType of the message.iSequence ID of the message.If the clients expect to receive out-of-order responses, they may use the message ID to map responses back to their corresponding requests. If the client does not expect out-of-order responses, they are free to use the same message ID for all messages.The server's contract regarding message IDs is that all responses must have the same message ID as their corresponding requests.jContents of the message.kType of message being sent.lA call to a specific method.1The message body is the request arguments struct.mResponse to a call.'The message body is the response union.nFailure to make a call.Note: This message type is not1 used for exceptions that are defined under the throwsj clause of a method. Those exceptions are part of the response union of the method and are received in a Reply7. This message type is used for Thrift-level failures.o&One-way call that expects no response. efghijklmnopq efghijknlmo efghijklmnoefghijklmnopq(c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalNone%&69:;DOQRTyuA pair of field identifier and maybe a value stored in the field. If the value is absent, the field will be ignored.zpThe Pinchable type class is implemented by types that can be sent or received over the wire as Thrift payloads.{  tag for this type.$For most custom types, this will be , , or . For enums, it will be 5. If the instance automatically derived with use of GenericI, this is not required because it is automatically determined by use of Field or  Enumeration.| Convert an a into a H. For structs, , , and  may be used to construct H objects tagged with .}Read a H back into an a. For structs,  and & may be used to retrieve field values.~hGPinchable is used to impelment support for automatically deriving instances of Pinchable via generics. % tag to use for objects of this type.4Converts a generic representation of a value into a H. Converts a H5 back into the generic representation of the object.Implementation of | based on ~.Implementation of } based on ~. Construct a y from a field identifier and a z value. Construct a y* from a field identifier and an optional z value. Construct a H tagged with a \ from the given key-value pairs. Optional fields whose values were omitted will be ignored. 3struct [1 .= ("Hello" :: Text), 2 .= (42 :: Int16)] Constructs a H tagged with . union 1 ("foo" :: ByteString)Given a field ID and a  Value TStruct, get the value stored in the struct under that field ID. The lookup fails if the field is absent or if it's not the same type as expected by this call's context.Given a field ID and a  Value TStruct_, get the optional value stored in the struct under the given field ID. The value returned is Nothing] if it was absent or the wrong type. The lookup fails only if the value retrieved fails to }. Helper to } values by matching TTypes. Helper to | maps.%yz{|}~  foldlWithKey567yz{|}~z{|}|}y~567yz{|}|}~(c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalNone%&,023459:;DIQRT Represents a void result for methods.AThis should be used as an element in a response union along with  tags. For a method, cvoid setValue(..) throws (1: ValueAlreadyExists alreadyExists, 2: InternalError internalError)/Something similar to the following can be used. data SetValueResponse = SetValueAlreadyExists (Field 1 ValueAlreadyExists) | SetValueInternalError (Field 2 InternalError) | SetValueSuccess Void deriving (Generic) instance Pinchable SetValueResponsebData types that represent Thrift enums must have one constructor for each enum item accepting an 2 object tagged with the corresponding enum value. kdata Role = RoleUser (Enumeration 1) | RoleAdmin (Enumeration 2) deriving Generic instance Pinchable Role^Fields of data types that represent structs, unions, and exceptions should be wrapped inside & and tagged with the field identifier. ]data Foo = Foo (Field 1 Text) (Field 2 (Maybe Int32)) deriving Generic instance Pinchable Foo Udata A = A (Field 1 Int32) | B (Field 2 Text) deriving Generic instance Pinchable FooFields which hold Maybe< values are treated as optional. All fields values must be z to automatically derive a  Pinchable! instance for the new data type.;Implemented by TType tags whose values know how to combine."Gets the current value of a field. ,let Foo a' _ = {- ... -} a = getField a'Puts a value inside a field. +Foo (putField "Hello") (putField (Just 42)) A lens on Field( wrappers for use with the lens library. $person & name . field .~ "new value""Convenience function to construct  objects. let role = RoleUser enum (c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalNone /A ByteString Builder that knows its final size.5Build a ByteString from the given ByteString builder.Append two Builders into one.Serialize a single signed byte.!Serialize a single unsigned byte.7Serialize a signed 16-bit integer in big endian format.7Serialize a signed 32-bit integer in big endian format.7Serialize a signed 64-bit integer in big endian format.ESerialize a signed 64-bit floating point number in big endian format.2Inlcude the given ByteString as-is in the builder.Note that because this operation is applied lazily, we will maintain a reference to the ByteString until the builder is executed. (c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalNoneOTGProtocols define a specific way to convert values into binary and back. Serializes a H into a ByteString builder. Returns a Builder0 and the total length of the serialized content. Serializes a e+ and its payload into a ByteString builder. Returns a Builder0 and the total length of the serialized content.Reads a H4 from a ByteString and returns leftovers from parse.Reads a e# and its payload from a ByteString.Reads a H from a ByteString.(c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalNoneB (c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalNone:<=OT A simple ByteString parser.KSuccess continuation. Called with the remaining bytestring and the result.6Failure continuation. Called with the failure message.YRun the parser on the given ByteString. Return either the failure message or the result.sRun the parser on the given ByteString. Return either the failure message or the result and any left-over content.take n gets exactly n bytes or fails the parse./Produces the next byte and advances the parser./Produces the next byte and advances the parser.9Produces a signed 16-bit integer and advances the parser.9Produces a signed 32-bit integer and advances the parser.9Produces a signed 64-bit integer and advances the parser.@Produces a 64-bit floating point number and advances the parser.  (c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalNone%&T9Provides an implementation of the Thrift Binary Protocol.Map a TType to its type code.+Map a type code to the corresponding TType.'      !"#$%&'()*+,'      !"#$%&'()*+, (c) Ben Gamari 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalNone %&0OT-A compact message type.:Provides an implementation of the Thrift Compact Protocol..Map a TType to its type code./+Map a type code to the corresponding TType.A01-23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcde./fghijThe compact type codea four-bit (unshifted) payloadk301- 23456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcde./fghijk (c) Abhinav Gupta 2015BSD3!Abhinav Gupta <mail@abhinavg.net> experimentalNoneDREncode the given z value using the given .7unpack $ encode binaryProtocol ["a" :: ByteString, "b"]"[11,0,0,0,2,0,0,0,1,97,0,0,0,1,98] Decode a z value from the using the given ./let s = pack [11,0,0,0,2,0,0,0,1,97,0,0,0,1,98]5decode binaryProtocol s :: Either String [ByteString]Right ["a","b"] Encode the e using the given . Mlet request = GetUserRequest (putField "jsmith") (putField []) message = C "getUser" Call 42 request in encodeMessage binaryProtocol message  Decode a e using the given .RdecodeMessage binaryProtocol bs >>= getMessageBody :: Either String GetUserRequestMRight (GetUserRequest {userName = Field "jsmith", userAttributes = Field []})Build a Message.Read the message contents.This returns a LeftA result if the message contents do not match the requested type.Name of the target method.Type of the message. Message ID.HMessage payload. This must be an object which serializes into a struct.=  !"#56FGHeihgknlmoyz{|}Bz{|}|}56yHFGeghighiklmno #"! Safe lmnopqrstuvwxmstuvwx lmnopqrstuvwxy !"#$%&'(('&)*%+$#,"! -./0123456789:;<= > ? @ABCDEFGHIJKLMNOOPQRSTUVWXYZ[\]]^_`abcdefghijkllmnopqrstuvwxyz{|}~ > ?   > A   >                                  ! " # $ $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < =        >    ?     @           A B  C D EF4GHIJKLMNOPQR$pinch-0.3.0.2-777RSwXwMKV6kl5a1VTaADPinch.Internal.FoldListPinch.Internal.TTypePinch.Internal.PinchablePinch.Internal.ValuePinch.Internal.MessagePinch.Internal.GenericPinch.Internal.BuilderPinch.ProtocolPinch.Internal.ParserPinch.Protocol.BinaryPinch.Protocol.CompactPinchPinch.Internal.Pinchable.ParserPinch.Pinchable PinchablePinch.Internal.Bits Paths_pinchbaseData.TraversablesequencemapM Data.FoldabletoListfoldl'foldr SomeTTypeIsTTypettypeTTypeTBoolTByteTDoubleTInt16TInt32TInt64TBinaryTStructTMapTSetTList TExceptionTUnionTTextTEnum ttypeEqualityttypeEqT$fIsTTypeTList $fIsTTypeTSet $fIsTTypeTMap$fIsTTypeTStruct$fIsTTypeTBinary$fIsTTypeTInt64$fIsTTypeTInt32$fIsTTypeTInt16$fIsTTypeTDouble$fIsTTypeTByte$fIsTTypeTBool$fHashableTType$fShowSomeTType $fEqTType $fShowTTypeParser runParser parserCatchFoldListfromMap fromFoldablemap replicate replicateM$fMonoidFoldList$fHashableFoldList$fNFDataFoldList $fEqFoldList$fTraversableFoldList$fFoldableFoldList$fFunctorFoldList$fShowFoldList SomeValueValueVBoolVByteVDoubleVInt16VInt32VInt64VBinaryVStructVMapVNullMapVSetVListMapItem castValue valueTType$fHashableSomeValue$fHashableValue$fNFDataSomeValue $fEqSomeValue $fNFDataValue $fEqValue $fShowValue $fShowMapItem$fHashableMapItem$fNFDataMapItem $fEqMapItem$fShowSomeValueMessage messageName messageType messageIdmessagePayload MessageTypeCallReply ExceptionOneway$fNFDataMessage$fNFDataMessageType$fShowMessageType$fEqMessageType$fDataMessageType$fGenericMessageType $fShowMessage $fEqMessage$fGenericMessage FieldPairTagpinchunpinch GPinchableGTaggPinchgUnpinch genericPinchgenericUnpinch.=?=structunion.:.:?$fPinchableSet$fPinchableHashSet$fPinchableMap$fPinchableHashMap $fPinchable[]$fPinchableVector$fPinchableInt64$fPinchableInt32$fPinchableInt16$fPinchableDouble$fPinchableInt8$fPinchableBool$fPinchableText$fPinchableText0$fPinchableByteString$fPinchableByteString0$fPinchableValueVoid EnumerationFieldgetFieldputFieldfieldenum$fGPinchableK1$fGPinchableK10$fNFDataEnumeration$fGPinchableK11$fGPinchableK12$fGPinchable:+:$fGPinchable:*:$fGPinchableM1$fGPinchableM10$fCombinableTStruct$fBoundedField $fEqField $fEnumField$fFoldableField$fFunctorField$fGenericField $fMonoidField $fNFDataField $fOrdField $fShowField$fTraversableField$fEqEnumeration$fGenericEnumeration$fOrdEnumeration$fShowEnumeration$fEqVoid $fGenericVoid $fOrdVoid $fShowVoidBuilder runBuilderappendint8word8int16BEint32BEint64BEdoubleBE byteString$fMonoidBuilderProtocolserializeValueserializeMessagedeserializeValue'deserializeMessagedeserializeValue runParser'takeint16int32int64double $fMonadParser$fApplicativeParser$fFunctorParserbinaryProtocolcompactProtocol$fIsTTypeTStopencodedecode encodeMessage decodeMessage mkMessagegetMessageBodySuccessFailureunParser$fMonadPlusParser$fAlternativeParsertoSetareEqual areEqual1 areEqual2checkedUnpinchpinchMap unpinchMap CombinablecombineB primFixed w16ShiftL w32ShiftL w64ShiftLcast toTypeCode fromTypeCodebinarySerializeMessagebinaryDeserializeMessagebinaryMessageParserparseMessageTypebinaryDeserialize binaryParsergetTType parseTType parseBool parseByte parseDouble parseInt16 parseInt32 parseInt64 parseBinaryparseMapparseSet parseList parseStructbinarySerializeserializeBinary serializeBool serializeByteserializeDoubleserializeInt16serializeInt32serializeInt64 serializeList serializeSetserializeStruct serializeMapserializeCollection messageCodefromMessageCodestringtypeCodeCType toCompactCodefromCompactCode SomeCTypeCStop CBoolTrue CBoolFalseCByteCInt16CInt32CInt64CDoubleCBinaryCListCSetCMapCStructTStop protocolIdversioncompactSerializeMessagecompactDeserializeMessagecompactMessageParsercompactDeserialize compactParser intToZigZag zigZagToInt parseVarintgetCTypeparseCollectioncompactSerializeserializeVarint tTypeToCType cTypeToTType compactCode compactCode' typeCode'catchIObindirlibdirdatadir libexecdir sysconfdir getBinDir getLibDir getDataDir getLibexecDir getSysconfDirgetDataFileName