Safe Haskell  SafeInferred 

Language  Haskell2010 
Extensions  DeriveGeneric 
Internals, exposed mostly for potential use by testsuites and benchmarks.
Not recommended to be used from within other independent libraries.
 data Typed a = Typed TypeInformation a
 data TypeInformation
 newtype Hash32 = Hash32 Word32
 newtype Hash64 = Hash64 Word64
 typed :: Typeable a => TypeFormat > a > Typed a
 makeTypeInformation :: TypeFormat > TypeRep > TypeInformation
 data TypeFormat
 getFormat :: TypeInformation > TypeFormat
 typecheck :: Typeable a => Typed a > Either String (Typed a)
 erase :: Typed a > a
 preserialize :: TypeInformation > TypeInformation
 data TypeRep = TypeRep TyCon [TypeRep]
 stripTypeRep :: TypeRep > TypeRep
 unStripTypeRep :: TypeRep > TypeRep
 hashType32 :: TypeRep > Hash32
 hashType64 :: TypeRep > Hash64
 data TyCon = TyCon String String String
 stripTyCon :: TyCon > TyCon
 unStripTyCon :: TyCon > TyCon
Typed
A value suitable to be typechecked using the contained extra type information.
Typed TypeInformation a  Using this data constructor directly is unsafe, as it allows
construction of illtyped 
data TypeInformation Source
Type information stored alongside a value to be serialized, so that the
recipient can do consistency checks. See TypeFormat
for more detailed
information on the fields.
A hash value of a TypeRep
. Currently a 32bit value created using
the MurmurHash2 algorithm.
A hash value of a TypeRep
. Currently a 64bit value created using
the MurmurHash2 algorithm.
typed :: Typeable a => TypeFormat > a > Typed a Source
makeTypeInformation :: TypeFormat > TypeRep > TypeInformation Source
Create the TypeInformation
to be stored inside a Typed
value from
a TypeRep
.
data TypeFormat Source
Different ways of including/verifying type information of serialized messages.
Untyped  Include no type information. 
Hashed32  Compare types by their hash values (using the MurmurHash2 algorithm).

Hashed64  Like 
Shown  Compare

Full  Compare the full representation of a data type.

getFormat :: TypeInformation > TypeFormat Source
Extract which TypeFormat
was used to create a certain TypeInformation
.
If the type is Cached'
, then the contained information is assumed
wellformed. In the public API, this is safe to do, since only welltyped
Typed
values can be created in the first place.
typecheck :: Typeable a => Typed a > Either String (Typed a) Source
Typecheck a Typed
. Returns the (welltyped) input, or an error message
if the types don't work out.
preserialize :: TypeInformation > TypeInformation Source
Sometimes it can be beneficial to serialize the type information in
advance, so that the maybe costly serialization step does not have to be
repeated on every invocation of encode
. Preserialization comes at a price
though, as the directly contained ByteString
requires its length to
be included in the final serialization, yielding a 8byte overhead for the
required Int64
, and one for the tag of what was serialized
("shown or full?").
This function calculates the serialized version of TypeInformation
in
cases where the required 9 bytes are negligible (determined by an
arbitrary threshold, currently 10*9 bytes).
Used to make encodeTyped
more efficient; the source
there also makes a good usage example.
TypeRep
TypeRep
without the (internal) fingerprint.
stripTypeRep :: TypeRep > TypeRep Source
Strip a TypeRep
off the fingerprint. Inverse of unStripTypeRep
.
unStripTypeRep :: TypeRep > TypeRep Source
Add a fingerprint to a TypeRep
. Inverse of stripTypeRep
.
hashType32 :: TypeRep > Hash32 Source
Hash a TypeRep
to a 32bit digest.
hashType64 :: TypeRep > Hash64 Source
Hash a TypeRep
to a 64bit digest.
TyCon
TyCon
without the (internal) fingerprint.
stripTyCon :: TyCon > TyCon Source
Strip a TyCon
off the fingerprint. Inverse of unStripTyCon
.
unStripTyCon :: TyCon > TyCon Source
Add a fingerprint to a TyCon
. Inverse of stripTyCon
.