Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 Hash = Hash Word64
- typed :: Typeable a => TypeFormat -> a -> Typed a
- data TypeFormat
- getFormat :: TypeInformation -> TypeFormat
- typecheck :: Typeable a => Typed a -> Either String (Typed a)
- erase :: Typed a -> a
- precache :: Typed a -> Typed a
- data TypeRep = TypeRep TyCon [TypeRep]
- stripTypeRep :: TypeRep -> TypeRep
- unStripTypeRep :: TypeRep -> TypeRep
- hashType :: TypeRep -> Hash
- 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 ill-typed |
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 64-bit value created using
the MurmurHash2 algorithm.
typed :: Typeable a => TypeFormat -> a -> Typed a Source
data TypeFormat Source
Different ways of including/verifying type information of serialized messages.
Untyped | Include no type information.
|
Hashed | Compare types by their hash values (using the MurmurHash2 algorithm).
|
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
.
typecheck :: Typeable a => Typed a -> Either String (Typed a) Source
Typecheck a Typed
. Returns the (well-typed) input, or an error message
if the types don't work out.
precache :: Typed a -> Typed a Source
Calculate the serialization of a TypeInformation
and store it in a
Typed
value so it does not have to be recalculated on every call to
encode
.
This is typically applied to a dummy value created using typed
and
the desired TypeFormat
; the actual data is then inserted using
reValue
, which is how
encodeTyped
works.
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
.
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
.