Skip to content

Commit ab7213f

Browse files
authored
GHC-58481 overloaded labels example (#552)
* [GHC-58481] Link the new location of the error message index * [GHC-58481] Add example from overloaded labels
1 parent a6a0bf6 commit ab7213f

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{-# LANGUAGE DataKinds #-}
2+
{-# LANGUAGE OverloadedLabels #-}
3+
4+
module Label where
5+
6+
import GHC.OverloadedLabels (IsLabel)
7+
8+
foo :: (IsLabel "foo" ()) => ()
9+
foo = #foo
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module Label where
2+
3+
import GHC.OverloadedLabels (IsLabel)
4+
5+
foo :: (IsLabel "foo" ()) => ()
6+
foo = #foo
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Use of overloaded labels without enabled language extension
3+
---
4+
5+
In this example the user attempted to use an overloaded label without enabling the `OverloadedLabels` extension, which leads to this generic parsing error. [Overloaded Labels](https://downloads.haskell.org/ghc/latest/docs/users_guide/exts/overloaded_labels.html#extension-OverloadedLabels) assign a special meaning to the `#` character in front of an identifier, or (since GHC 9.6) any non-empty double-quoted string.
6+
7+
```
8+
messages/GHC-58481/example5/before/Label.hs:4:7: error: [GHC-58481] parse error on input ‘#’
9+
|
10+
4 | foo = #foo
11+
| ^
12+
```

message-index/messages/GHC-58481/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ However if the error is not separately defined there, a problem with parsing is
1212

1313
There may be many different reasons why the error `GHC-58481` was emitted, ranging from incorrect syntax that requires additional language extensions, to an expression mistakenly put in the same line as another.
1414

15-
Below are some examples of code that generate this generic parsing error. Please be encouraged to report more or contribute via [error-messages github](https://github.com/haskell/error-messages).
15+
Below are some examples of code that generate this generic parsing error. Please be encouraged to report more or contribute via [error-message-index github](https://github.com/haskell/error-message-index).

0 commit comments

Comments
 (0)