[commit: ghc] master: Add -funbox-strict-primitive-fields example (332e681)

Johan Tibell <[email protected]>
Newsgroups gmane.comp.lang.haskell.cvs.ghc
Message-ID <[email protected]>
Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/332e68122d578fbc09f49b61a628217a60a70877

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

commit 332e68122d578fbc09f49b61a628217a60a70877
Author: Johan Tibell <[email protected]>
Date:   Sun Dec 9 16:12:36 2012 -0800

    Add -funbox-strict-primitive-fields example

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

 docs/users_guide/using.xml |   27 +++++++++++++++++++++------
 1 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/docs/users_guide/using.xml b/docs/users_guide/using.xml
index 918176f..1e81955 100644
--- a/docs/users_guide/using.xml
+++ b/docs/users_guide/using.xml
@@ -1868,12 +1868,27 @@ f "2"    = 2
             <indexterm><primary>constructor fields, strict</primary></indexterm>
           </term>
           <listitem>
-            <para>This option causes all constructor fields which are marked
-            strict (i.e. &ldquo;!&rdquo;) and which representation is smaller or
-            equal to the size of a pointer to be unpacked if possible. It is
-            equivalent to adding an <literal>UNPACK</literal> pragma (see <xref
-            linkend="unpack-pragma"/>) to every strict constructor field that
-            fullfills the size restriction.
+            <para>This option causes all constructor fields which are
+            marked strict (i.e. &ldquo;!&rdquo;) and which
+            representation is smaller or equal to the size of a
+            pointer to be unpacked, if possible. It is equivalent to
+            adding an <literal>UNPACK</literal> pragma (see <xref
+            linkend="unpack-pragma"/>) to every strict constructor
+            field that fullfills the size restriction.
+            </para>
+
+            <para>For example, the constructor fields in the following
+            data types
+<programlisting>
+data A = A !Int
+data B = B !A
+newtype C = C B
+data D = D !C
+</programlisting>
+            would all be represented by a single
+            <literal>Int#</literal> (see <xref linkend="primitives"/>)
+            value with
+            <option>-funbox-strict-primitive-fields</option> enabled.
             </para>
 
             <para>This option is less of a sledgehammer than
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.