1 {-# OPTIONS_GHC -fno-implicit-prelude #-}
2 -----------------------------------------------------------------------------
4 -- Module : Unsafe.Coerce
5 -- Copyright : Malcolm Wallace 2006
6 -- License : BSD-style (see the LICENSE file in the distribution)
8 -- Maintainer : libraries@haskell.org
9 -- Stability : experimental
10 -- Portability : portable
12 -- The highly unsafe primitive 'unsafeCoerce' converts a value from any
13 -- type to any other type. Needless to say, if you use this function,
14 -- it is your responsibility to ensure that the old and new types have
15 -- identical internal representations, in order to prevent runtime corruption.
17 -- 'unsafeCoerce' is just a trivial wrapper for 'unsafeCoerce#';
18 -- see the latter for important documentation about correct usage.
20 module Unsafe.Coerce (unsafeCoerce) where
22 #if defined(__GLASGOW_HASKELL__)
23 import GHC.Base (unsafeCoerce#)
24 unsafeCoerce :: a -> b
25 unsafeCoerce = unsafeCoerce#
29 import NonStdUnsafeCoerce (unsafeCoerce)
33 import Hugs.IOExts (unsafeCoerce)