
#13875: ApplicativeDo desugaring is lazier than standard desugaring -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.3 Resolution: | Keywords: ApplicativeDo Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Other | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonmar): Wow, you're right. I hadn't realised this, and I think you're the first person to point it out. It's not limited to `Functor`, the problem occurs with `Applicative` too: {{{ Prelude Data.Maybe> :set -XApplicativeDo Prelude Data.Maybe> let f m = do () <- m; () <- m; return () Prelude Data.Maybe> :t f f :: Applicative f => f () -> f () Prelude Data.Maybe> isJust (f (Just undefined)) True }}} To fix this properly we would have to prevent `ApplicativeDo` from applying to any statement with a strict pattern match. In practice I doubt anyone is going to write `~p` to make `ApplicativeDo` work, but fortunately it still works for simple variable patterns. Ugh, I don't know what the best fix is here, but I agree at the very least we need some documentation. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13875#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler