beamable-0.1.1.0: Generic serializer/deserializer with compact representation

Safe HaskellNone
LanguageHaskell98

Data.Beamable.Internal

Synopsis

Documentation

class Beamable a where Source

Minimal complete definition

Nothing

Methods

beam :: a -> Builder Source

Serialize value into Builder

unbeam :: ByteString -> (a, ByteString) Source

Deserialize next value from ByteString, also returns leftovers

typeSignR :: [String] -> a -> Word64 Source

Get value's type signature, should work fine on undefined values takes list of strings with datatypes which already been traversed workaround to support recursive datatypes. In most cases you should be passing empty list in there.

typeSign :: Beamable a => a -> Word64 Source

Get type signature of arbitrary Beamable datatatype encoded as Word64 hash with all constructors and datatypes in it. It's preferable to use typeSign against typeSignR, because implementation of later might change.

data Phantom a Source

Phantom a has just one possible value, like (), and is encoded as a 0-byte sequence. However, its typeSign depends on the typeSign of its parameter.

Constructors

Phantom 

Instances