Skip to content

Easily make Typeable keys pure, so that Typeable can be handled efficiently across communications

Data.Typeable: Easily make Typeable keys pure(used in Eq), so that Typeable keys don´t vary from run to run. This permits an efficient storage of the keys in files and to be transmitted trough communications as well as processed without loss of efficiency. Actually gaining efficiency probably, since the keys caches are not necessary.

Currently, whenever the user needs to communicate types, he must transmit the full string name for each type. Moreover, in the reception, the programmer is forced to handle these full string keys for mapping types to handlers, in equality checks etc. if the type keys are pure, the efficiency of key handling can be keept across communications.

short description of task: Istead of using a Hash( stringType, generatedKey) use hashString (string-of-type)

Long description:

  1. drop the cache; drop newKey

  2. use instead the expression:

 Key $ hashString str

whenever a new key is needed from the package Data.HashTable:

hashString :: String -> Int 

the key obtained is pure so:

  1. drop the "IO" in typeRepKey signature
Edited by Simon Marlow
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information