summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2013-08-29 13:01:16 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2013-08-29 16:45:19 +0100
commit33c880b43ed72d77f6b1d95d5ccefbd376c78c78 (patch)
tree653cde8582af549a61026fbf55cb978764c24f6d
parent04c9c3b23065916b7beb9cebc959a05786f01dbe (diff)
downloadhaskell-33c880b43ed72d77f6b1d95d5ccefbd376c78c78.tar.gz
Improve docs for -XNegativeLiterals
-rw-r--r--docs/users_guide/glasgow_exts.xml11
1 files changed, 8 insertions, 3 deletions
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index 7a1af04bf7..6c4046e319 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -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>