[project @ 2001-06-11 14:15:32 by simonpj]
authorsimonpj <unknown>
Mon, 11 Jun 2001 14:15:32 +0000 (14:15 +0000)
committersimonpj <unknown>
Mon, 11 Jun 2001 14:15:32 +0000 (14:15 +0000)
document data types with no constructors

ghc/docs/users_guide/glasgow_exts.sgml

index 390697f..c94c0a2 100644 (file)
@@ -96,6 +96,13 @@ Executive summary of our extensions:
     </varlistentry>
 
     <varlistentry>
+      <term>Data types with no constructors</term>
+      <listitem>
+       <para>See <xref LinkEnd="nullary types">.</para>
+      </listitem>
+    </varlistentry>
+
+    <varlistentry>
       <term>Parallel list comprehensions</term>
       <listitem>
        <para>An extension to the list comprehension syntax to support
@@ -415,6 +422,24 @@ The libraries documentatation gives more details on all these
 </sect1>
 
 
+<sect1 id="nullary types">
+<title>Data types with no constructors</title>
+
+<para>With the <option>-fglasgow-exts</options> flag, GHC lets you declare
+a data type with no constructors.  For example:</para>
+<programlisting>
+  data S      -- S :: *
+  data T a    -- T :: * -> *
+</programlisting>
+<para>Syntactically, the declaration lacks the "= constrs" part.  The 
+type can be parameterised, but only over ordinary types, of kind *; since
+Haskell does not have kind signatures, you cannot parameterise over higher-kinded
+types.</para>
+
+<para>Such data types have only one value, namely bottom.
+Nevertheless, they can be useful when defining "phantom types".</para>
+</sect1>
+
 <sect1 id="pattern-guards">
 <title>Pattern guards</title>