[GHC] #14112: bang patterns on pattern synonyms? (left vs right hand sides)

GHC ghc-devs at haskell.org
Mon Aug 28 21:04:41 UTC 2017


#14112: bang patterns on pattern synonyms? (left vs right hand sides)
-------------------------------------+-------------------------------------
        Reporter:  carter            |                Owner:  RyanGlScott
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.2.1
      Resolution:                    |             Keywords:
                                     |  PatternSynonyms
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 simonpj):

 > But what about pattern synonyms?

 That's an excellent point, one that I had not considered.

 The right thing to do would probably be to `seq` on the sub-pattern thus
 {{{
 pattern P x = Just !(Id x)
 }}}
 would give rise to a builder thus
 {{{
 P x = let !a = Id x
       in Just a
 }}}
 In short, when converting from pattern to expression, let!-bind the
 expressions gotten from converting each banged sub-pattern.

 But now I grant you that the cost/benefit ratio is less attractive.  I'm
 happy with A.

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


More information about the ghc-tickets mailing list