proposal: add 'unsafeCoerce'

Ross Paterson ross at
Fri Nov 17 08:36:40 EST 2006

Simon Marlow writes:
> On the existence of unsafeCoerce itself, I'm happy to see it in
> a standard place, but we should be very careful not to guarantee
> _anything_ about what it does. For example, GHC has some strange
> restrictions on what you can unsafeCoerce, and it's possible to crash
> the compiler by using it.

but on the other hand:

On Fri, Nov 10, 2006 at 11:32:40PM +1100, Donald Bruce Stewart wrote:
> ndmitchell:
> > I have programs which have to use CPP just
> > to find this single function.
> Agreed. I have cpp for the very same thing. The # must go!

So presumably Neil and Don think there are situations where it can be
safely used across implementations.  What are they?

More information about the Libraries mailing list