aboutsummaryrefslogtreecommitdiff
path: root/doc/markup.rst
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2018-05-01 18:08:16 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2018-05-01 18:11:09 +0200
commit53fd41f2510d9ae81079ef5a8bfdf5f515185387 (patch)
tree1ff0b7c225ec8c72cb5afcda940e87af4339c91b /doc/markup.rst
parent79c7159101c03bbbc7350e07963896ca2bb97c02 (diff)
parent271a9cb0c7a070deef8df2d4fb54ebe47a0bf560 (diff)
Merge branch 'ghc-head' with 'ghc-8.4'
Diffstat (limited to 'doc/markup.rst')
-rw-r--r--doc/markup.rst14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/markup.rst b/doc/markup.rst
index acabaa28..1a278da3 100644
--- a/doc/markup.rst
+++ b/doc/markup.rst
@@ -39,6 +39,8 @@ the following:
- A ``data`` declaration,
+- A ``pattern`` declaration,
+
- A ``newtype`` declaration,
- A ``type`` declaration
@@ -118,6 +120,15 @@ Constructors are documented like so: ::
or like this: ::
data T a b
+ = C1 -- ^ This is the documentation for the 'C1' constructor
+ a -- ^ This is the documentation for the argument of type 'a'
+ b -- ^ This is the documentation for the argument of type 'b'
+
+There is one edge case that is handled differently: only one ``-- ^``
+annotation occuring after the constructor and all its arguments is
+applied to the constructor, not its last argument: ::
+
+ data T a b
= C1 a b -- ^ This is the documentation for the 'C1' constructor
| C2 a b -- ^ This is the documentation for the 'C2' constructor
@@ -164,6 +175,9 @@ Individual arguments to a function may be documented like this: ::
-> Float -- ^ The 'Float' argument
-> IO () -- ^ The return value
+Pattern synonyms and GADT-style data constructors also support this
+style of documentation.
+
.. _module-description:
The Module Description