Commit f6d61129 authored by simonpj@microsoft.com's avatar simonpj@microsoft.com

Add notes about unsafeCoerce

parent 7929e422
......@@ -6072,7 +6072,7 @@ shortcoming is something that could be fixed, with some kind of pragma.)
</para>
</sect2>
<sect2> <title>The <literal>inline</literal> function </title>
<sect2> <title>The <literal>lazy</literal> function </title>
<para>
The <literal>lazy</literal> function restrains strictness analysis a little:
<programlisting>
......@@ -6097,6 +6097,21 @@ look strict in <literal>y</literal> which would defeat the whole
purpose of <literal>par</literal>.
</para>
</sect2>
<sect2> <title>The <literal>unsafeCoerce#</literal> function </title>
<para>
The function <literal>unsafeCoerce#</literal> allows you to side-step the
typechecker entirely. It has type
<programlisting>
unsafeCoerce# :: a -> b
</programlisting>
That is, it allows you to coerce any type into any other type. If you use this
function, you had better get it right, otherwise segmentation faults await.
It is generally used when you want to write a program that you know is
well-typed, but where Haskell's type system is not expressive enough to prove
that it is well typed.
</para>
</sect2>
</sect1>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment