summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2011-12-23 16:16:56 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2011-12-23 16:16:56 +0000
commit89c0f09ac144a6b0cd20adbf73b196cc99e90a8f (patch)
tree80c6b4b9fd9349d2596a19f4c7be9c0b88d15e20 /docs
parent416c5903f3b8cf4cdd4a03c8949489df18cd790a (diff)
downloadhaskell-89c0f09ac144a6b0cd20adbf73b196cc99e90a8f.tar.gz
Implemnt Trac #5712: show method for infix GADT constructors
This is a tiny feature improvement; see the ticket. I have updated the user manual too.
Diffstat (limited to 'docs')
-rw-r--r--docs/users_guide/glasgow_exts.xml14
1 files changed, 14 insertions, 0 deletions
diff --git a/docs/users_guide/glasgow_exts.xml b/docs/users_guide/glasgow_exts.xml
index 7443abfb23..e3c0e73dba 100644
--- a/docs/users_guide/glasgow_exts.xml
+++ b/docs/users_guide/glasgow_exts.xml
@@ -2944,6 +2944,20 @@ data Counter a where
As before, only one selector function is generated here, that for <literal>tag</literal>.
Nevertheless, you can still use all the field names in pattern matching and record construction.
</para></listitem>
+
+<listitem><para>
+In a GADT-style data type declaration there is no obvious way to specify that a data constructor
+should be infix, which makes a difference if you derive <literal>Show</literal> for the type.
+(Data constructors declared infix are displayed infix by the derived <literal>show</literal>.)
+So GHC implements the following design: a data constructor declared in a GADT-style data type
+declaration is displayed infix by <literal>Show</literal> iff (a) it is an operator symbol,
+(b) it has two arguments, (c) it has a programmer-supplied fixity declaration. For example
+<programlisting>
+ infix 6 (:--:)
+ data T a where
+ (:--:) :: Int -> Bool -> T Int
+</programlisting>
+</para></listitem>
</itemizedlist></para>
</sect2>