<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Unsafe.Coerce</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[ window.onload = function () {pageLoad();setSynopsis("mini_Unsafe-Coerce.html");}; //]]> </script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">base-4.5.1.0: Basic libraries</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Portability</th><td>portable</td></tr><tr><th>Stability</th><td>experimental</td></tr><tr><th>Maintainer</th><td>libraries@haskell.org</td></tr><tr><th>Safe Haskell</th><td>Unsafe</td></tr></table><p class="caption">Unsafe.Coerce</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>The highly unsafe primitive <code><a href="Unsafe-Coerce.html#v:unsafeCoerce">unsafeCoerce</a></code> converts a value from any type to any other type. Needless to say, if you use this function, it is your responsibility to ensure that the old and new types have identical internal representations, in order to prevent runtime corruption. </p><p>The types for which <code><a href="Unsafe-Coerce.html#v:unsafeCoerce">unsafeCoerce</a></code> is representation-safe may differ from compiler to compiler (and version to version). </p><ul><li> Documentation for correct usage in GHC will be found under <code><a href="../ghc-prim-0.2.0.0/GHC-Prim.html#v:unsafeCoerce-35-">unsafeCoerce#</a></code> in GHC.Base (around which <code><a href="Unsafe-Coerce.html#v:unsafeCoerce">unsafeCoerce</a></code> is just a trivial wrapper). </li><li> In nhc98, the only representation-safe coercions are between Enum types with the same range (e.g. Int, Int32, Char, Word32), or between a newtype and the type that it wraps. </li></ul></div></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:unsafeCoerce" class="def">unsafeCoerce</a> :: a -> b</p></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.11.0</p></div></body></html>