[Hat] using Hat with unsafeCoerce

Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk
Mon Oct 16 16:15:24 EDT 2006

roconnor at theorem.ca 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.


More information about the Hat mailing list