typehash-1.0.0.0: Create a unique hash value for a type.

Data.TypeHash

Description

Produce a hash for a type that is unique for that type. The hash takes both actual type names and type structure into account.

The purpose of the hash of a type is to be able to store the type of a persisted value together with the value. By comparing the type hash of a persisted value and the expected value we can know if the persistened value is of the correct type.

The current implementation is not really a hash, but a string representation of the type structure.

Synopsis

Documentation

newtype TypeHash Source

The type of a hashed type.

Constructors

TypeHash String 

typeHash :: Data a => a -> TypeHashSource

Turn the type of the value into a type hash.

data Type Source

Constructors

Name 

Fields

typeName :: String
 
Data 

Fields

typeName :: String
 
constrs :: [(String, [Field])]
 

Instances

gType :: Data a => [String] -> a -> TypeSource

gConstr :: Data a => [String] -> a -> Constr -> (String, [Field])Source