lol-0.3.0.0: A library for lattice cryptography.

Safe HaskellNone
LanguageHaskell2010

Crypto.Lol.Types.Proto

Description

Convenient interfaces for serialization with protocol buffers.

Synopsis

Documentation

class Protoable a where Source

Conversion between Haskell types and their protocol buffer representations.

Associated Types

type ProtoType a Source

The protocol buffer type for a.

Methods

toProto :: a -> ProtoType a Source

Convert from a type to its protocol buffer representation.

fromProto :: MonadError String m => ProtoType a -> m a Source

Convert from a protocol buffer representation.

Instances

Protoable a => Protoable [a] Source 
(Protoable a, Protoable b) => Protoable (a, b) Source 
(Fact m, Reflects k q Double) => Protoable (CT m (RRq k q Double)) Source 
(Fact m, Reflects k q Int64) => Protoable (CT m (ZqBasic k q Int64)) Source 
(Fact m, Reflects k q Double) => Protoable (RT m (RRq k q Double)) Source 
(Fact m, Reflects k q Int64) => Protoable (RT m (ZqBasic k q Int64)) Source 
(Fact m, CElt t r, Protoable (UCyc t m D r)) => Protoable (Cyc t m r) Source 
(Fact m, Protoable (t m r)) => Protoable (UCyc t m D r) Source 

msgPut :: (ReflectDescriptor (ProtoType a), Wire (ProtoType a), Protoable a) => a -> ByteString Source

Serialize a Haskell type to its protocol buffer ByteString.

msgGet :: (ReflectDescriptor (ProtoType a), Wire (ProtoType a), Protoable a) => ByteString -> Either String (a, ByteString) Source

Read a protocol buffer ByteString to a Haskell type.