[GHC] #12235: Wrong compilation of bang patterns

GHC ghc-devs at haskell.org
Mon Jun 27 11:44:57 UTC 2016


#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:                    |
-------------------------------------+-------------------------------------
Changes (by rwbarton):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 It should fail. Pattern matching is top-to-bottom, left-to-right, and
 according to the user's guide

 > Matching an expression e against a pattern !p is done by first
 evaluating e (to WHNF) and then matching the result against p.

 So on the third line, we evaluate `i` to WHNF before checking whether the
 head of the list is `B`.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12235#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list