Re: using Hat with unsafeCoerce

Malcolm Wallace <[email protected]> Mon, 16 Oct 2006 21:15:24 +0100
Newsgroups gmane.comp.lang.haskell.hat
Organization Dept of Computer Science, University of York
Message-ID <[email protected]>
[email protected] writes:

> I have a program that is standalone expect for a dependency on 
> unsafeCoerce.  Is it possible to use Hat to trace through this program?

Yes, it should be (with a little work).  The current set of libraries
available within Hat does not include unsafeCoerce, but not for any good
reason other than that the portable subset of the base libraries does
not define it either.

To add unsafeCoerce into Hat, you would need to write a short wrapper
module something like this:

    module Somewhere.Unsafe where
    import qualified TraceOrigSomewhere.Unsafe
    foreign import haskell "Somewhere.Unsafe.unsafeCoerce" :: a -> b

replacing Somewhere.Unsafe by the real location where the original
function is found, of course.  Add your new module to the source tree in
src/hatlib, and also add it to the definition of TRANSSRCS in
src/hatlib/Makefile.  Build (or rebuild) and install the Hat package.
That should be all that is needed.

Regards,
    Malcolm