Commit 14ce3bb4 authored by simonpj's avatar simonpj
Browse files

[project @ 2001-06-11 14:15:32 by simonpj]

document data types with no constructors
parent 1c4e5ade
......@@ -95,6 +95,13 @@ Executive summary of our extensions:
</listitem>
</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>
......@@ -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>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment