haskell / haskell/error-messages
Reporting multiple errors is often confusing
- Dominant language
- No language data
- Stars
- 76
- Forks
- 19
- PR merge metrics
- No merged PRs in 30d
Description
Here's a small program
```
data T = T Int Int Int Int Int
f ts = [ x | T _ _ x _ _ < ts ]. -- typo, I meant <-
```
And here is the error message:
```
S.hs:3:10: error: [GHC-88464]
Variable not in scope: x
|
3 | f ts = [ x | T _ _ x _ _ < ts ]
| ^
S.hs:3:16: error: [GHC-88464]
• Found hole: _ :: Int
• In the first argument of ‘T’, namely ‘_’
In the first argument of ‘(<)’, namely ‘T _ _ x _ _’
In the expression: T _ _ x _ _ < ts
• Relevant bindings include
ts :: T (bound at S.hs:3:3)
f :: T -> [a] (bound at S.hs:3:1)
Valid hole fits include
maxBound :: forall a. Bounded a => a
with maxBound @Int
(imported from ‘Prelude’ at S.hs:1:1
(and originally defined in ‘GHC.Internal.Enum’))
minBound :: forall a. Bounded a => a
with minBound @Int
(imported from ‘Prelude’ at S.hs:1:1
(and originally defined in ‘GHC.Internal.Enum’))
|
3 | f ts = [ x | T _ _ x _ _ < ts ]
| ^
S.hs:3:18: error: [GHC-88464]
• Found hole: _ :: Int
• In the second argument of ‘T’, namely ‘_’
In the first argument of ‘(<)’, namely ‘T _ _ x _ _’
In the expression: T _ _ x _ _ < ts
• Relevant bindings include
ts :: T (bound at S.hs:3:3)
f :: T -> [a] (bound at S.hs:3:1)
Valid hole fits include
maxBound :: forall a. Bounded a => a
with maxBound @Int
(imported from ‘Prelude’ at S.hs:1:1
(and originally defined in ‘GHC.Internal.Enum’))
minBound :: forall a. Bounded a => a
with minBound @Int
(imported from ‘Prelude’ at S.hs:1:1
(and originally defined in ‘GHC.Internal.Enum’))
|
3 | f ts = [ x | T _ _ x _ _ < ts ]
| ^
S.hs:3:20: error: [GHC-88464]
Variable not in scope: x :: Int
|
3 | f ts = [ x | T _ _ x _ _ < ts ]
| ^
S.hs:3:22: error: [GHC-88464]
• Found hole: _ :: Int
• In the fourth argument of ‘T’, namely ‘_’
In the first argument of ‘(<)’, namely ‘T _ _ x _ _’
In the expression: T _ _ x _ _ < ts
• Relevant bindings include
ts :: T (bound at S.hs:3:3)
f :: T -> [a] (bound at S.hs:3:1)
Valid hole fits include
maxBound :: forall a. Bounded a => a
with maxBound @Int
(imported from ‘Prelude’ at S.hs:1:1
(and originally defined in ‘GHC.Internal.Enum’))
minBound :: forall a. Bounded a => a
with minBound @Int
(imported from ‘Prelude’ at S.hs:1:1
(and originally defined in ‘GHC.Internal.Enum’))
|
3 | f ts = [ x | T _ _ x _ _ < ts ]
| ^
S.hs:3:24: error: [GHC-88464]
• Found hole: _ :: Int
• In the fifth argument of ‘T’, namely ‘_’
In the first argument of ‘(<)’, namely ‘T _ _ x _ _’
In the expression: T _ _ x _ _ < ts
• Relevant bindings include
ts :: T (bound at S.hs:3:3)
f :: T -> [a] (bound at S.hs:3:1)
Valid hole fits include
maxBound :: forall a. Bounded a => a
with maxBound @Int
(imported from ‘Prelude’ at S.hs:1:1
(and originally defined in ‘GHC.Internal.Enum’))
minBound :: forall a. Bounded a => a
with minBound @Int
(imported from ‘Prelude’ at S.hs:1:1
(and originally defined in ‘GHC.Internal.Enum’))
|
3 | f ts = [ x | T _ _ x _ _ < ts ]
| ^
```
The first message is good, the rest is nonsense.
I'd be happy if GHC only ever reported one error (if it's the "right one).
If you do want to report multiple errors it's important to skip forward enough to not get this kind of nonsens.
Perhaps after an error in a top level definition GHC should proceed to the next top level definition.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.