pinch-0.3.0.1: An alternative implementation of Thrift for Haskell.

Copyright(c) Abhinav Gupta 2015
LicenseBSD3
MaintainerAbhinav Gupta <mail@abhinavg.net>
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Pinch.Protocol

Description

Protocols in Pinch only need to know how to serialize and deserialize Value objects. Types that want to be serialized into/from Thrift payloads define how to convert them to/from Value objects via Pinchable.

Synopsis

Documentation

data Protocol Source

Protocols define a specific way to convert values into binary and back.

Constructors

Protocol 

Fields

serializeValue :: forall a. IsTType a => Value a -> Builder

Serializes a Value into a ByteString builder.

Returns a Builder and the total length of the serialized content.

serializeMessage :: Message -> Builder

Serializes a Message and its payload into a ByteString builder.

Returns a Builder and the total length of the serialized content.

deserializeValue' :: forall a. IsTType a => ByteString -> Either String (ByteString, Value a)

Reads a Value from a ByteString and returns leftovers from parse.

deserializeMessage :: ByteString -> Either String Message

Reads a Message and its payload from a ByteString.

deserializeValue :: forall a. IsTType a => Protocol -> ByteString -> Either String (Value a) Source

Reads a Value from a ByteString.