
#12235: Wrong compilation of bang patterns -------------------------------------+------------------------------------- Reporter: osa1 | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nomeata): I agree with rwbarton. When matching `(undefined, [C])` against the patterns, it will match it against `(i, [])` and fail, and then against `(i, (A : ts))` and fail. Now it will be matched against `(!i, (B : ts))`. Comparing a tuple requires matching the individual components, from left to right. So it matches `undefined` against `!i`. According to the docs for bang patterns, as you quote them, this is done by first evaluating the expression to WHNF, which triggers the `undefined`, and this happens before `[C]` is matched against `(B:ts)`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12235#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler