[GHC] #8952: Bang patterns don't work as the specification says

#8952: Bang patterns don't work as the specification says --------------------------+------------------------------------------------ Reporter: dolio | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: | Version: 7.6.3 Compiler | Operating System: Unknown/Multiple Keywords: | Type of failure: Incorrect result at runtime Architecture: | Test Case: Unknown/Multiple | Blocking: Difficulty: | Unknown | Blocked By: | Related Tickets: | --------------------------+------------------------------------------------ In investigating the behavior of bang patterns for an implementation of my own, I came across a discrepancy between the specification and GHC's implementation. Here is an example: {{{ case Nothing of !(~(Just x)) -> 5 Nothing -> 12 }}} This evaluates to 12. In other words, !(~p) is equivalent to p. However, the bang patterns description says that this should be equivalent to: {{{ Nothing `seq` case Nothing of ~(Just x) -> 5 Nothing -> 12 }}} which evaluates to 5. So, one of either the description or the implementation must be incorrect. In fact, GHC is even a bit confused, as it issues a warning about overlapping patterns for the bang pattern case statement, even though the successful branch is the 'unreachable' one. The description makes more sense to me, but I'm not terribly invested in the behavior of this; it is admittedly a pretty obscure corner case. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8952 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8952: Bang patterns don't work as the specification says ------------------------------------------------+-------------------------- Reporter: dolio | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result at runtime | Unknown/Multiple Test Case: | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by simonpj): Dead right, thank you. Easy to fix. Patch coming. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8952#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8952: Bang patterns don't work as the specification says
------------------------------------------------+--------------------------
Reporter: dolio | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect result at runtime | Unknown/Multiple
Test Case: | Difficulty:
Blocking: | Unknown
| Blocked By:
| Related Tickets:
------------------------------------------------+--------------------------
Comment (by Simon Peyton Jones

#8952: Bang patterns don't work as the specification says ------------------------------------------------+-------------------------- Reporter: dolio | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result at runtime | Unknown/Multiple Test Case: deSugar/should_run/T8952 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by simonpj): * status: new => merge * testcase: => deSugar/should_run/T8952 Comment: Merge only if convenient. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8952#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8952: Bang patterns don't work as the specification says ------------------------------------------------+-------------------------- Reporter: dolio | Owner: Type: bug | Status: closed Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result at runtime | Unknown/Multiple Test Case: deSugar/should_run/T8952 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed * milestone: => 7.8.1 Comment: Merged, thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8952#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC