proposal: add 'unsafeCoerce'

Neil Mitchell ndmitchell at
Tue Nov 21 18:24:57 EST 2006


> Or as a hint that we should introduce a ``pseudo-polymorphic pseudo-function''
> safeCoerce :: a -> b

While this may be a useful function (whatever semantics it might end
up having), its not the function that I need to use :) The whole point
of my use is to make Haskell compilers accept a program that does not
have a type system that can be expressed in Haskell, or that can't be
easily expressed. This has to be unsafe, because if the necessary
safety invariants could be inferred by Haskell, that's basically the
same as it doing the type checking.

If you give unsafeCoerce any safety properties, I think you're going
to destroy at least some of its uses.



More information about the Libraries mailing list