Repository : ssh://[email protected]/ghc On branch : master Link : http://ghc.haskell.org/trac/ghc/changeset/33c880b43ed72d77f6b1d95d5ccefbd376c78c78/ghc
>--------------------------------------------------------------- commit 33c880b43ed72d77f6b1d95d5ccefbd376c78c78 Author: Simon Peyton Jones <[email protected]> Date: Thu Aug 29 13:01:16 2013 +0100 Improve docs for -XNegativeLiterals >--------------------------------------------------------------- 33c880b43ed72d77f6b1d95d5ccefbd376c78c78 docs/users_guide/glasgow_exts.xml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml index 7a1af04..6c4046e 100644 --- a/docs/users_guide/glasgow_exts.xml +++ b/docs/users_guide/glasgow_exts.xml @@ -446,13 +446,18 @@ 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>. - </para> - - <para> The language extension <option>-XNegativeLiterals</option> means that it is instead desugared as <literal>fromInteger (-123)</literal>. </para> + + <para> + 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> <sect2 id="num-decimals"> _______________________________________________ ghc-commits mailing list [email protected] http://www.haskell.org/mailman/listinfo/ghc-commits
