
15 May
2015
15 May
'15
2:59 p.m.
Hello everyone, I'm trying to implement traversal over data structures and found Data.Typeable very useful for that. But it seems to be impossible to cast to specific typeclass, so that we can cast Typeable to something that is Show'able for example. It'd be usefull to have something like: data CanShow = forall a. CanShow a toConcrete :: (Typeable a) => a -> Maybe CanShow Implementing such datatypes for needed classes would allow to do some kind of class casting. Is it possible to implement this somehow? Is it a limitation of the implementation or a principal one? Thanks! Regards, Teodor.