Commit 33c880b4 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Improve docs for -XNegativeLiterals

parent 04c9c3b2
......@@ -446,12 +446,17 @@ Indeed, the bindings can even be recursive.
The literal <literal>-123</literal> is, according to
Haskell98 and Haskell 2010, desugared as
<literal>negate (fromInteger 123)</literal>.
The language extension <option>-XNegativeLiterals</option>
means that it is instead desugared as
<literal>fromInteger (-123)</literal>.
</para>
<para>
The language extension <option>-XNegativeLiterals</option>
means that it is instead desugared as
<literal>fromInteger (-123)</literal>.
This can make a difference when the positive and negative range of
a numeric data type don't match up. For example,
in 8-bit arithmetic -128 is representable, but +128 is not.
So <literal>negate (fromInteger 128)</literal> will elicit an
unexpected integer-literal-overflow message.
</para>
</sect2>
......
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