Skip to content

GHC-58481 overloaded labels example #552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions message-index/messages/GHC-58481/example5/after/Label.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedLabels #-}

module Label where

import GHC.OverloadedLabels (IsLabel)

foo :: (IsLabel "foo" ()) => ()
foo = #foo
6 changes: 6 additions & 0 deletions message-index/messages/GHC-58481/example5/before/Label.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module Label where

import GHC.OverloadedLabels (IsLabel)

foo :: (IsLabel "foo" ()) => ()
foo = #foo
12 changes: 12 additions & 0 deletions message-index/messages/GHC-58481/example5/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Use of overloaded labels without enabled language extension
---

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.

```
messages/GHC-58481/example5/before/Label.hs:4:7: error: [GHC-58481] parse error on input ‘#’
|
4 | foo = #foo
| ^
```
2 changes: 1 addition & 1 deletion message-index/messages/GHC-58481/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ However if the error is not separately defined there, a problem with parsing is

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.

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).
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).