[project @ 2002-10-11 16:56:09 by simonpj]
[ghc-hetmet.git] / ghc / docs / users_guide / glasgow_exts.sgml
index 61b40c0..5c3e74e 100644 (file)
@@ -420,6 +420,33 @@ contains up to date information on recursive monadic bindings.
 
 </sect2>
 
+
+<sect2> <title> Infix type constructors </title>
+
+<para>GHC supports infix type constructors, much as it supports infix data constructors.  For example:
+<programlisting>
+  infixl 5 :+:
+
+  data a :+: b = Inl a | Inr b
+
+  f :: a `Either` b -> a :+: b
+  f (Left x) = Inl x
+</programlisting>
+</para>
+<para>The lexical 
+syntax of an infix type constructor is just like that of an infix data constructor: either
+it's an operator beginning with ":", or it is an ordinary (alphabetic) type constructor enclosed in
+back-quotes.</para>
+
+<para>
+When you give a fixity declaration, the fixity applies to both the data constructor and the
+type constructor with the specified name.  You cannot give different fixities to the type constructor T
+and the data constructor T.
+</para>
+
+
+</sect2>
+
    <!-- ===================== PARALLEL LIST COMPREHENSIONS ===================  -->
 
   <sect2 id="parallel-list-comprehensions">
@@ -2950,7 +2977,7 @@ The documentation here describes the realisation in GHC.  (It's rather sketchy j
 Tim Sheard is going to expand it.)
 </para>
 
-<sect2>  <title> Using Template Haskell </title>
+<sect2>  <title> Syntax </title>
 <para>
     Template Haskell has the following new syntactic constructions.  You need to use the flag  
                <literal>-fglasgow-exts</literal> to switch these syntactic extensions on.