Avoid unnecessary evaluation when unpacking constructors
Consider
data T a = MkT !a
foo :: T (a,b) -> a
foo (MkT (x,y)) = x
GHC will extract the first component of the MkT, evaluate it, and then extract the first component of the pair. The evaluation step isn't needed, since the component is known to be already-evaluated. UNPACK directives won't work here, because the component is polymorphic.
In the email thread, Tyson posted an example where this extra eval made a significant difference to his inner loop: http://www.haskell.org/pipermail/glasgow-haskell-users/2008-October/015796.html
Simon
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.8.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |