
9 Dec
2006
9 Dec
'06
1:47 p.m.
On 12/9/06, Alfonso Acosta
I've been using Data.Dynamic but the Typeable requirement doesn't go well with FFI declarations (which don't accept type contexts).
Can you be a little more specific?
mt2mgt :: MyType a b -> MyGenType mt2mgt = MyGenType.myToDyn
mgt2mt :: MyGentype -> MyType a b mgt2mt (MyGenType dyn) = myfromDyn dyn
The question is, ¿if only mt2mgt and mgt2mt are used by the user, would the use of unsafeCoerce be dangerous?
mgt2mt . mt2mgt :: MyType a b -> MyType c d
Yes, it's dangerous. The reason Dynamic requires Typeable is to be
able to check that you're casting Dynamic back to the original type.
--
Taral