[GHC] #10892: ApplicativeDo should use *> and <*
GHC
ghc-devs at haskell.org
Mon May 22 18:51:06 UTC 2017
#10892: ApplicativeDo should use *> and <*
-------------------------------------+-------------------------------------
Reporter: simonmar | Owner: bollu
Type: task | Status: new
Priority: high | Milestone: 8.4.1
Component: Compiler | Version: 7.11
Resolution: | Keywords: ApplicativeDo
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking: 12143
Related Tickets: #13309 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by AaronFriel):
A user ElvishJerricco on Reddit posted an interesting test case
([[https://www.reddit.com/r/haskell/comments/6c7hen/applicativedo_overhaul_request_for_comments/dhw9po0/?context=3|my
analysis here]]). There were two interesting things that popped out.
Here's the reduced test case:
{{{#!hs
{-# LANGUAGE ApplicativeDo #-}
foo :: Monad f => f () -> f ()
foo f = f
bar :: Monad f => f () -> f ()
bar f = do
_ <- f
foo f
}}}
Clearly the two statements of `bar` are independent, and so we should use
`*>` here too. The interesting thing to me is that this doesn't trigger
the `ApplicativeDo` desugaring at all! The desugarer outputs: `bar = f >>=
\_ -> foo f`. So this is another thing to make sure my revised rules
cover.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10892#comment:27>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list