Hi,

Given a TypeRep and a Dynamic value with type corresponding to the
TypeRep, I'd like to be able to use fromDyn *without* specifying a type
(given as an additional 'default' argument) (since it is somewhat known
from the TypeRep).

That is, I'd like an undefinedOf that can be used in

extract :: Typeable a => TypeRep -> Dynamic -> a
extract typerep dyn = fromDyn (undefinedOf typerep) dyn

For instance, if TypeRep is Int,
extract Int dyn = fromDyn (undefined::Int) dyn

Is it possible to write "extract" ?

Thanks,
Thu
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to