Top-level bindings are broken for polymorphic values
Top-level pattern bindings don't work for polymorphic values. Here's an example program:
[x] = [id]
ghci gives this the type
*Main> :t x
x :: GHC.Prim.Any -> GHC.Prim.Any
which can't be used
*Main> x ()
<interactive>:1:2:
Couldn't match expected type `GHC.Prim.Any'
against inferred type `()'
In the first argument of `x', namely `()'
In the expression: x ()
In the definition of `it': it = x ()
Adding a type signature doesn't help:
x :: a -> a
[x] = [id]
Couldn't match expected type `forall a. a -> a'
against inferred type `a -> a'
Probable cause: `id' is applied to too few arguments
In the expression: id
In the expression: [id]
Trac metadata
Trac field | Value |
---|---|
Version | 6.8.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | Unknown |
Architecture | Unknown |