
#12143: ApplicativeDo Fails to Desugar 'return True' -------------------------------------+------------------------------------- Reporter: MichaelBurge | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 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: -------------------------------------+------------------------------------- If I bring in a spurious parameter, ApplicativeDo correctly infers Functor. {{{ Prelude> :t \m -> do { x <- m; return True; } \m -> do { x <- m; return True; } :: Functor f => f t -> f Bool Prelude> :t \m -> do { m; return True; } \m -> do { m; return True; } :: Monad m => m a -> m Bool }}} However, without the spurious parameter, ApplicativeDo assumes monad. {{{ Prelude> :t do { return True; } do { return True; } :: Monad m => m Bool }}} The first block in particular shows two examples that seem inconsistent when placed next to each other. It seems like if 'x' is unused, then 'x <- m' and 'm' should be equivalent. I would expect all of these to desugar to Functor or Applicative. And maybe 'return True' should be Monad, but 'do { return True; }' should be Applicative? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12143 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler