Skip to content

Commit 0615bd7

Browse files
committed
[GHC-58481] Add example from overloaded labels
1 parent 6fe43a3 commit 0615bd7

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
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 examplem 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+
```

0 commit comments

Comments
 (0)