GHC complains about applying a function to one argument
When this function is compiled:
let f = (\x -> f x) :: [a] -> b
GHC gives this error message:
Foo.hs:1:12:
Couldn't match type `b' with `b1'
`b' is a rigid type variable bound by
the inferred type of f :: [a] -> b at Foo.hs:1:1
`b1' is a rigid type variable bound by
an expression type signature: [a1] -> b1 at Foo.hs:1:5
Expected type: [a1] -> b1
Actual type: [a] -> b
The function `f' is applied to one argument,
but its type `[a] -> b' has only one
In the expression: f x
In the expression: (\ x -> f x) :: [a] -> b
Foo.hs:1:12:
Couldn't match type `a' with `a1'
`a' is a rigid type variable bound by
the inferred type of f :: [a] -> b at Foo.hs:1:1
`a1' is a rigid type variable bound by
an expression type signature: [a1] -> b1 at Foo.hs:1:5
Expected type: [a1] -> b1
Actual type: [a] -> b
The function `f' is applied to one argument,
but its type `[a] -> b' has only one
In the expression: f x
In the expression: (\ x -> f x) :: [a] -> b
The erroneous part is:
The function `f' is applied to one argument,
but its type `[a] -> b' has only one
In the expression: f x
In the expression: (\ x -> f x) :: [a] -> b
This error message should not be present, as applying a function to one argument is not a problem.
This happens in GHCi as well.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.4.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |