Skip to content

Commit 762580b

Browse files
author
David Binder
committed
Add documentation for GHC-94458
1 parent cc7c29c commit 762580b

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module IllegalHaddockComment where
2+
3+
main = print (fizz ++ buzz)
4+
where
5+
-- The sound of a refreshing beverage.
6+
fizz = "fizz"
7+
-- The sound of an annoying fly.
8+
buzz = "buzz"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module IllegalHaddockComment where
2+
3+
main = print (fizz ++ buzz)
4+
where
5+
-- | The sound of a refreshing beverage.
6+
fizz = "fizz"
7+
-- | The sound of an annoying fly.
8+
buzz = "buzz"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
title: Illegal Haddock comments for definitions in where clause
3+
---
4+
5+
In this example, the user tried to document the two identifiers "fizz" and "buzz" that are introduced in a local where clause.
6+
Since these identifiers are not part of the public API, a warning is emitted that Haddock comments are not allowed in that place.
7+
A normal comment can be used instead.
8+
9+
```
10+
messages/GHC-94458/illegalHaddockComment/before/IllegalHaddockComment.hs:5:5: warning: [GHC-94458] [-Winvalid-haddock]
11+
A Haddock comment cannot appear in this position and will be ignored.
12+
|
13+
5 | -- | The sound of a refreshing beverage.
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15+
16+
messages/GHC-94458/illegalHaddockComment/before/IllegalHaddockComment.hs:7:5: warning: [GHC-94458] [-Winvalid-haddock]
17+
A Haddock comment cannot appear in this position and will be ignored.
18+
|
19+
7 | -- | The sound of an annoying fly.
20+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21+
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Illegal position of Haddock comment
3+
summary: A Haddock comment appears in an illegal position
4+
severity: warning
5+
flag: -Winvalid-haddock
6+
introduced: 9.6.1
7+
---
8+
9+
Haddock comments are used to document entities of Haskell programs, and are used to generate API documentation which can be displayed on Hackage or as tooltips in editors. This error is emitted when a Haddock comment is attached to an entity that cannot be documented this way. A normal comment should be used instead.

0 commit comments

Comments
 (0)