Skip to content

Commit

Permalink
Wibbles to documentation for promoted lists and tuples (Trac #9882)
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Peyton Jones committed Dec 15, 2014
1 parent a972bdd commit a3e6915
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/users_guide/glasgow_exts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6884,7 +6884,7 @@ is a single quote.</para>
<sect2 id="promoted-lists-and-tuples">
<title>Promoted list and tuple types</title>
<para>
With <option>-XTypeOperators</option>, Haskell's list and tuple types are natively promoted to kinds, and enjoy the
With <option>-XDataKinds</option>, Haskell's list and tuple types are natively promoted to kinds, and enjoy the
same convenient syntax at the type level, albeit prefixed with a quote:
<programlisting>
data HList :: [*] -> * where
Expand All @@ -6903,10 +6903,12 @@ foo1 = HCons (3::Int) HNil
foo2 :: HList [Int, Bool]
foo2 = ...
</programlisting>
(Note: the declaration for <literal>HCons</literal> also requires <option>-XTypeOperators</option>
because of infix type operator <literal>(:')</literal>.)
For type-level lists of <emphasis>two or more elements</emphasis>,
such as the signature of <literal>foo2</literal> above, the quote may be omitted because the meaning is
umambiguous. But for lists of one or zero elements (as in <literal>foo0</literal>
and <literal>foo1</literal>), the quote is required, becuase the types <literal>[]</literal>
unambiguous. But for lists of one or zero elements (as in <literal>foo0</literal>
and <literal>foo1</literal>), the quote is required, because the types <literal>[]</literal>
and <literal>[Int]</literal> have existing meanings in Haskell.
</para>
</sect2>
Expand Down

0 comments on commit a3e6915

Please sign in to comment.