proposal: add 'unsafeCoerce'
Malcolm.Wallace at cs.york.ac.uk
Mon Apr 2 10:36:50 EDT 2007
I wrote (back in November):
> Currently, all implementations provide either the 'unsafeCoerce' or
> 'unsafeCoerce#' functions, but they live in implementation-specific
> locations. This proposal is to adopt the Haskell'98-compatible name
> 'unsafeCoerce', and to add it to the standard base library package.
Discussion finished, with a general feeling that this would be a good
thing. There were some objections from Iavor (and others) that the
behaviour of 'unsafeCoerce' is entirely implementation-dependent.
Others replied, yes, indeed, but it _is_ marked "unsafe". The proposal
merely makes the same name available in all compilers (to avoid the need
for CPP), but gives no guarantees about its effects. You must satisfy
yourself about whether any given usage is safe or not, with any given
So I have just pushed a patch for this. The final location chosen in
the module hierarchy was Unsafe.Coerce.
More information about the Libraries