[Haskell-cafe] Dynamic types through unsafeCoerce

Lemmih lemmih at gmail.com
Tue Dec 12 13:55:21 EST 2006

On 12/12/06, Alfonso Acosta <alfonso.acosta at gmail.com> wrote:
> On 12/10/06, Lemmih <lemmih at gmail.com> wrote:
> > How about using a StablePtr to a Dynamic?
> Uhm, that's a good idea cause  no Typeable context will then be
> required and thus the function can be exported by the FFI.
> On the other hand, using Data.Dynamic requires any type to be an
> instance of Typeable. And thus requires the user to make such
> instantiation (which is a pain)
> GHC supports the "deriving" clause for the Typeable class, but it's
> not standard Haskell98 (and as far as I know, for example hugs doesn't
> support it)
> So it would be great to be able to use unsafeCoerce.

Ah, you want type-safe casts without using Typeable? Good luck, you'll need it.


More information about the Haskell-Cafe mailing list