In GHCi a result is wrong when -fdefer-typed-holes is used with underscore alone
I open this ticket instead of #13579
to restate it and I closed the other.\\
In fact a result of the compiler which I think is wrong misled me.\\
Therefore I close tickets #13602
and #13557
.\\
In Haskell2010 Language Report it is said that :\\
- underscore "_ " all by itself is a reserved identifier.\\
- underscore "_" is treated as a lowercase letter, and can occur wherever a lowercase letter can.\\
So _e
is an identifier like __
\\
GHCi gives a bad result when he computed the code below.\\
Prelude> :set -fdefer-typed-holes
Prelude> let f = map (\x -> True) [_, _]
<interactive>:2:27: warning: [-Wtyped-holes]
* Found hole: _ :: a0
Where: `a0' is an ambiguous type variable
* In the expression: _
In the second argument of `map', namely `[_, _]'
In the expression: map (\ x -> True) [_, _]
* Relevant bindings include
f :: [Bool] (bound at <interactive>:2:5)
<interactive>:2:30: warning: [-Wtyped-holes]
* Found hole: _ :: a0
Where: `a0' is an ambiguous type variable
* In the expression: _
In the second argument of `map', namely `[_, _]'
In the expression: map (\ x -> True) [_, _]
* Relevant bindings include
f :: [Bool] (bound at <interactive>:2:5)
Prelude> f
[True,True]
The underscore "_" is alone , all by itself and yet is recognized as an identifier, and GHCi gives a result.\\ This is the bug.
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |