beamable- Generic serializer/deserializer with compact representation

Safe HaskellNone




class Beamable a whereSource


beam :: a -> BuilderSource

Serialize value into Builder

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

Deserialize next value from ByteString, also returns leftovers

typeSignR :: [String] -> a -> Word64Source

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 -> Word64Source

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.