put 'unsafeCoerce' in a standard location
[haskell-directory.git] / Unsafe / Coerce.hs
1 -----------------------------------------------------------------------------
2 -- |
3 -- Module      :  Unsafe.Coerce
4 -- Copyright   :  Malcolm Wallace 2006
5 -- License     :  BSD-style (see the LICENSE file in the distribution)
6 --
7 -- Maintainer  :  libraries@haskell.org
8 -- Stability   :  experimental
9 -- Portability :  portable
10 --
11 -- The highly unsafe primitive 'unsafeCoerce' converts a value from any
12 -- type to any other type.  Needless to say, if you use this function,
13 -- it is your responsibility to ensure that the old and new types have
14 -- identical internal representations, in order to prevent runtime corruption.
15
16 module Unsafe.Coerce (unsafeCoerce) where
17
18 #if defined(__GLASGOW_HASKELL__)
19 import GHC.Base (unsafeCoerce#)
20 unsafeCoerce :: a -> b
21 unsafeCoerce = unsafeCoerce#
22 #endif
23
24 #if defined(__NHC__)
25 import NonStdUnsafeCoerce (unsafeCoerce)
26 #endif
27
28 #if defined(__HUGS__)
29 import Hugs.Base (unsafeCoerce)
30 #endif