To ease the construction of Dynamic
values, we
introduce the following type class to help working with TypeRep
s:
class Typeable a where
typeOf :: a -> TypeRep
typeOf
function is overloaded to return the type
representation associated with a type. typeOf
is only used to
carry type information around so that overloading can be resolved.
Typeable
instances should never, ever look at this argument.Dynamic
library provide Typeable
instances
for all Prelude and Hugs/GHC extension library types. They are:
Prelude types:
Int, Char, Bool, Float, Double, Integer, (IO a),
[a], (Either a b), (Maybe a), (a->b),
(), (,), (,,), (,,,), (,,,,),
Ordering, Complex, Array, Handle
Hugs/GHC types:
Addr, Word8, Word16, Word32, Word64,
Int8,Int16,Int32,Int64,
ForeignObj, MVar, (ST s a), (StablePtr a)
GHC types:
Word, ByteArray, MutableByteArray