Loop
When patternmatching on (a,b), the variables a and b are sometimes evaluated eagerly, though they should not be. To see where this occurs, please try to evaluate f :
f = (1,error "this will not be evaluated!") .++. carefully f
(a,b) .++. (c,d) = (a+c,0)
carefully (a,b) = (1, a + b)
Note that the expected result here is (2,0). My workaround: the program works correctly if the last line is replaced by:
carefully x = (1, fst x + snd x)
Trac metadata
Trac field | Value |
---|---|
Version | 7.4.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |