On 12/9/06, Alfonso Acosta <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
"You can't prove anything."
   -- Gödel's Incompetence Theorem
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to