[GHC] #15100: `ApplicativeDo` needlessly uses `join` too much

GHC ghc-devs at haskell.org
Sun Apr 29 18:54:50 UTC 2018


#15100: `ApplicativeDo` needlessly uses `join` too much
-------------------------------------+-------------------------------------
           Reporter:  ekmett         |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.6.1
          Component:  Compiler       |           Version:  8.4.2
  (CodeGen)                          |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{#!hs
 foo = do
   A 1
   B 2
   C 3
   return ()
 }}}

 produces very different code than

 {{{#!hs
 foo = do
   A 1
   B 2
   C 3
 }}}

 for no good reason. Currently we check to see if the last clause is a
 `return` or something else, and then bolt a `join` in if it isn't
 `return`. But this check is too conservative. If it isn't a `return` but
 doesn't reference any of the variables above, you can still desugar it
 with `(<*>)`.

 We found this during a twitch livestream in front of an audience of 127
 people. =)

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


More information about the ghc-tickets mailing list