[commit: ghc] master: Document the Negative Literals extension (ffd7da3)

Ian Lynagh igloo at ghc.haskell.org
Thu Aug 1 00:54:05 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/ffd7da35c140a38dd4410bb7edde27ea9fb2173c

>---------------------------------------------------------------

commit ffd7da35c140a38dd4410bb7edde27ea9fb2173c
Author: Ian Lynagh <ian at well-typed.com>
Date:   Wed Jul 31 23:51:43 2013 +0100

    Document the Negative Literals extension

>---------------------------------------------------------------

 docs/users_guide/glasgow_exts.xml |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index 57f94b4..f972a4b 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -440,6 +440,21 @@ Indeed, the bindings can even be recursive.
       </para>
    </sect2>
 
+    <sect2 id="negative-literals">
+      <title>Negative Literals</title>
+      <para>
+          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>
+   </sect2>
+
     <!-- ====================== HIERARCHICAL MODULES =======================  -->
 
 






More information about the ghc-commits mailing list