Skip to content

Commit e20de0f

Browse files
Merge pull request #422 from haskellfoundation/GHC-94458
Add documentation for GHC-94458 and GHC-05661
2 parents 3817bd1 + 326bba5 commit e20de0f

File tree

8 files changed

+77
-0
lines changed

8 files changed

+77
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{-# LANGUAGE ImportQualifiedPost #-}
2+
module DoubleQualified where
3+
4+
import Prelude qualified
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{-# LANGUAGE ImportQualifiedPost #-}
2+
module DoubleQualified where
3+
4+
import qualified Prelude qualified
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: The module Prelude is incorrectly imported as qualified
3+
---
4+
5+
In this example, the `qualified` modifier was used both before and after the name of the module which is imported.
6+
This is not legal syntax, and GHC emits this error message.
7+
The error can be fixed by removing one of the two occurrences.
8+
9+
```
10+
messages/GHC-05661/doubleQualified/before/DoubleQualified.hs:4:26: error: [GHC-05661]
11+
Multiple occurrences of 'qualified'
12+
|
13+
4 | import qualified Prelude qualified
14+
| ^^^^^^^^^
15+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Cannot use qualified both before and after the module
3+
summary: A module cannot be imported using the qualified modifier both before and after the name of the module
4+
severity: error
5+
introduced: 9.6.1
6+
---
7+
8+
With the language extension `ImportQualifiedPost` it is possible to import a module using the `qualified` modifier after the name of the module. But it is not legal to use the `qualified` modifier both before and after the name of the module.
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)