Skip to content

Commit ee4d3d8

Browse files
Merge pull request #396 from BinderDavid/add-error-44432
Add error message for error GHC-44432
2 parents 8433ca5 + 35d3607 commit ee4d3d8

File tree

13 files changed

+135
-0
lines changed

13 files changed

+135
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Type signature lacks an accompanying binding
3+
summary: A type signature was provided, but no binding was given.
4+
severity: error
5+
introduced: 9.6.1
6+
---
7+
8+
If a type signature is given for a name, then that name also needs to be defined.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module MissingBinding where
2+
3+
fortytwo :: Integer
4+
fortytwo =
5+
let
6+
two :: Integer
7+
two = 2
8+
in
9+
40 + two
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module MissingBinding where
2+
3+
fortytwo :: Integer
4+
fortytwo =
5+
let
6+
two :: Integer
7+
in
8+
40 + two
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Type signature lacks an accompanying binding
3+
---
4+
5+
If a type signature is given for a name in a local let expression, then the name also needs to be defined.
6+
7+
In this example, a type signature was given for the name `two` in a let expression, but no definition was specified.
8+
This error can be fixed by adding a definition which accompanies the type signature.
9+
10+
## Error Message
11+
12+
```
13+
MissingBinding.hs:6:5: error: [GHC-44432]
14+
The type signature for ‘two’ lacks an accompanying binding
15+
|
16+
6 | two :: Integer
17+
| ^^^
18+
```
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module MissingBinding where
2+
3+
someBoolean :: Bool
4+
someBoolean = True
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module MissingBinding where
2+
3+
someBoolean :: Bool
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: Type signature lacks an accompanying binding
3+
---
4+
5+
If a type signature is given for a name in a Haskell module, then the name also needs to be defined.
6+
7+
In this example, a type signature was given for the name `someBoolean` in a Haskell module, but no definition was specified.
8+
This error can be fixed by adding a definition which accompanies the type signature.
9+
10+
## Error Message
11+
12+
```
13+
MissingBinding.hs:3:1: error: [GHC-44432]
14+
The type signature for ‘someBoolean’ lacks an accompanying binding
15+
|
16+
3 | someBoolean :: Bool
17+
| ^^^^^^^^^^^
18+
```
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module MissingBinding where
2+
3+
import Numeric.Natural
4+
5+
factorial :: Natural -> Natural
6+
factorial n
7+
| n == 0 = 1
8+
| otherwise = n * factorial (n - 1)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module MissingBinding where
2+
3+
import Numeric.Natural
4+
5+
factorial :: Natural -> Natural
6+
fatcorial n
7+
| n == 0 = 1
8+
| otherwise = n * factorial (n - 1)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
title: Type signature lacks an accompanying binding
3+
---
4+
5+
If a type signature is given for a name in a Haskell module, then the name also needs to be defined.
6+
7+
In this example, the programmer misspelt the name `factorial`.
8+
GHC helpfully suggests that `fatcorial` might be the intended spelling.
9+
The error can be fixed by correcting the typo.
10+
11+
## Error Message
12+
13+
```
14+
MissingBinding.hs:5:1: error: [GHC-44432]
15+
The type signature for ‘factorial’ lacks an accompanying binding
16+
Suggested fix: Perhaps use ‘fatcorial’ (Defined at Main.hs:6:1)
17+
|
18+
5 | factorial :: Natural -> Natural
19+
| ^^^^^^^^^
20+
```

0 commit comments

Comments
 (0)