Let's get this finished

malcolm-ffi at cs.york.ac.uk malcolm-ffi at cs.york.ac.uk
Thu Jan 4 10:10:17 EST 2001

> (1) It isn't H98 and in fact its interface cannot be
>     implemented with H98[1].  The problem are the routines
>     with signatures in patterns:
>       malloc :: Storable a => IO (Ptr a)
>       malloc :: IO (Ptr a) = mallocBytes (sizeOf (undefined::a))

I discovered this problem, and its fix, just before Christmas when I
tried to implement MarshallUtils for nhc98.  I seem to have lost my
source code right now, but as I recall, we can keep this signature
just by wrapping the old implementation:

        malloc :: Storable a => IO (Ptr a)
        malloc = malloc_ undefined
        malloc_ :: Storable a => a -> IO (Ptr a)
        malloc_ x = mallocBytes (sizeOf x)


More information about the FFI mailing list