haskell / haskell/error-messages

Illegal .. notation for constructor LogOutView. The constructor has no labeled field

Open
#15 14 comments 1 reaction 0 assignees View on GitHub
status:Composing error message tool:GHC type:error-message
Dominant language
No language data
Stars
76
Forks
19
PR merge metrics
No merged PRs in 30d

Description

Given this code:

```haskell
data LogOutView = LogOutView

instance View LogOutView where
html LogOutView { .. } = [hsx||]
```

GHC errors with:

```haskell
Illegal .. notation for constructor LogOutView. The constructor has no labeled field
```

A better error message would be:

```haskell
The 'data LogOutView' has no fields, so you cannot use 'LogOutView { .. }' here. Perhaps remove the '{ .. }' here, or add some fields to 'data LogOutView'?
```

(Taken from https://github.com/digitallyinduced/haskell-ux)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the provided LogOutView example with GHC and confirm the current diagnostic for record wildcards on a constructor with no fields. Trace the diagnostic path for this error, then update it to explain that the data type has no fields and suggest removing `{ .. }` or adding fields. Done when the example produces the proposed clearer message.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.