Incorrect result at runtime with list comprehensions in that case
- With GHC 8.0.2\\
Prelude> [x | x <- [_, _], False]
<interactive>:1:12: error:
* Found hole: _ :: t
Where: `t' is a rigid type variable bound by
the inferred type of it :: [t] at <interactive>:1:1
* In the expression: _
In the expression: [_, _]
In a stmt of a list comprehension: x <- [_, _]
* Relevant bindings include it :: [t] (bound at <interactive>:1:1)
<interactive>:1:15: error:
* Found hole: _ :: t
Where: `t' is a rigid type variable bound by
the inferred type of it :: [t] at <interactive>:1:1
* In the expression: _
In the expression: [_, _]
In a stmt of a list comprehension: x <- [_, _]
* Relevant bindings include it :: [t] (bound at <interactive>:1:1)
Prelude>\\
This result makes no sense here.\\ The result will always be the empty list [].\\
- With GHC 7.6.3\\
Prelude> [x | x <- [_, _], False]
<interactive>:2:12: Pattern syntax in expression context: _
<interactive>:2:12: Pattern syntax in expression context: _
Prelude>
This result also makes no sense here.\\ Similarly this result will always be the empty list [].
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 |