Simon Peyton Jones | 30 Apr 17:51 2012

[commit: ghc] master: Document eta expansion under GHC bugs and infelicities (2822e00)

Repository : ssh://

On branch  : master


commit 2822e00d3e126e30c3ed2ca8dc90a075180e42ec
Author: Simon Peyton Jones <simonpj <at>>
Date:   Mon Apr 30 16:43:02 2012 +0100

    Document eta expansion under GHC bugs and infelicities


 docs/users_guide/bugs.xml |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/docs/users_guide/bugs.xml b/docs/users_guide/bugs.xml
index c2abe45..49d6a8d 100644
--- a/docs/users_guide/bugs.xml
+++ b/docs/users_guide/bugs.xml
 <at>  <at>  -107,17 +107,31  <at>  <at>  main = do args &lt;- getArgs
   <sect3 id="infelicities-exprs-pats">
       <title>Expressions and patterns</title>

-	<para>None known.</para>
+    <para>In its default mode, GHC makes some programs sligtly more defined 
+    than they should be. For example, consider
+    <programlisting>
+f :: [a] -> b -> b
+f [] = error "urk"
+f (x:xs) = \v -> v
+main = print (f [] `seq` True)
+    </programlisting>
+This should call <literal>error</literal> but actually prints <literal>True</literal>.
+Reason: GHC eta-expands <literal>f</literal> to
+    <programlisting>
+f :: [a] -> b -> b
+f []     v = error "urk"
+f (x:xs) v = v
+    </programlisting>
+This improves efficiency slightly but significantly for most programs, and
+is bad for only a few.  To suppress this bogus "optimisation" use <option>-fpedantic-bottoms</option>.

     <sect3 id="infelicities-decls">
       <title>Declarations and bindings</title>

-      <para>GHC's typechecker makes all pattern bindings monomorphic
-      by default; this behaviour can be disabled with
-      <option>-XNoMonoPatBinds</option>.  See <xref
-      linkend="options-language" />.</para>
       <para>In its default mode, GHC does not accept datatype contexts,
       as it has been decided to remove them from the next version of the
       language standard. This behaviour can be controlled with the