
#12143: ApplicativeDo Fails to Desugar 'return True' -------------------------------------+------------------------------------- Reporter: MichaelBurge | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by MichaelBurge: @@ -1,2 +1,1 @@ - If I bring in a spurious parameter, ApplicativeDo correctly infers Functor - if I bind an unused variable: + ApplicativeDo correctly infers Functor if I bind an unused variable: @@ -14,3 +13,2 @@ - I would expect the second example desugar to Functor or Applicative. And - maybe 'return True' should be Monad, but 'do { return True; }' should be - Applicative? + And maybe 'return True' should be Monad, but 'do { return True; }' should + be Applicative? New description: ApplicativeDo correctly infers Functor if I bind an unused variable: {{{ 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 }}} It seems like if 'x' is unused, then 'x <- m' and 'm' should be equivalent. And maybe 'return True' should be Monad, but 'do { return True; }' should be Applicative? -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12143#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler