10 Dec
2006
10 Dec
'06
2:47 a.m.
On 12/9/06, Alfonso Acosta <alfonso.acosta@gmail.com> wrote:
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 <taralx@gmail.com> "You can't prove anything." -- Gödel's Incompetence Theorem