Comparing [Fun]Ptrs

Sven Panne Sven_Panne at
Thu Mar 6 05:58:07 EST 2003

Volker Stolz wrote:
> [...]
> class ToPtr a where
>    toPtr :: a -> Ptr b
> [...]

The problem with a class like this is that you can't define any sensible
instances, apart from the trivial one for Ptr itself. There is no
guarantee at all that e.g. a FunPtr, an Int, ... fits into a Ptr and
there are actually platforms where this is not the case. It's perhaps
OK as a hack, but it has no place in a general FFI library,


More information about the FFI mailing list