summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2014-11-21 13:02:45 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2014-11-21 13:02:45 +0000
commit4ba4cc7aaaf2bff31bc8474c8ba40e1cbe3e3875 (patch)
tree7460b9a9c6e2f9a64bd3b96137646ccaec63209b /docs
parenteaccc72162194d12a33aa454b57c126bcabcdd5d (diff)
downloadhaskell-4ba4cc7aaaf2bff31bc8474c8ba40e1cbe3e3875.tar.gz
Fix Trac #9815
Dot-dot record-wildcard notation is simply illegal for constructors without any named fields, but that was neither documented nor checked. This patch does so - Make the check in RnPat - Add test T9815 - Fix CmmLayoutStack which was using the illegal form (!) - Document in user manual
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/glasgow_exts.xml14
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index 30742b333d..a21e677943 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -2337,7 +2337,7 @@ More details:
<itemizedlist>
<listitem><para>
Record wildcards in patterns can be mixed with other patterns, including puns
-(<xref linkend="record-puns"/>); for example, in a pattern <literal>C {a
+(<xref linkend="record-puns"/>); for example, in a pattern <literal>(C {a
= 1, b, ..})</literal>. Additionally, record wildcards can be used
wherever record patterns occur, including in <literal>let</literal>
bindings and at the top-level. For example, the top-level binding
@@ -2404,6 +2404,18 @@ and omitting <literal>c</literal> since the variable <literal>c</literal>
is not in scope (apart from the binding of the
record selector <literal>c</literal>, of course).
</para></listitem>
+
+<listitem><para>
+Record wildcards cannot be used (a) in a record update construct, and (b) for data
+constructors that are not declared with record fields. For example:
+<programlisting>
+f x = x { v=True, .. } -- Illegal (a)
+
+data T = MkT Int Bool
+g = MkT { .. } -- Illegal (b)
+h (MkT { .. }) = True -- Illegal (b)
+</programlisting>
+</para></listitem>
</itemizedlist>
</para>