[GHC] #12143: ApplicativeDo Fails to Desugar 'return True'

#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

#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,2 @@ - If I bring in a spurious parameter, ApplicativeDo correctly infers - Functor. + If I bring in a spurious parameter, ApplicativeDo correctly infers Functor + if I bind an unused variable: @@ -11,5 +11,2 @@ - However, without the spurious parameter, ApplicativeDo assumes monad. - {{{ - Prelude> :t do { return True; } - do { return True; } :: Monad m => m Bool - }}} + It seems like if 'x' is unused, then 'x <- m' and 'm' should be + equivalent. @@ -17,5 +14,1 @@ - 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 + I would expect the second example desugar to Functor or Applicative. And New description: If I bring in a spurious parameter, 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. 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? -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12143#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * cc: RyanGlScott (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12143#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#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

#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: ApplicativeDo Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * keywords: => ApplicativeDo * cc: simonmar (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12143#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12143: ApplicativeDo Fails to Desugar 'return True' -------------------------------------+------------------------------------- Reporter: MichaelBurge | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: ApplicativeDo Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: 10892 | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * milestone: 8.2.1 => 8.4.1 Comment: This won't happen for 8.2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12143#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12143: ApplicativeDo Fails to Desugar 'return True' -------------------------------------+------------------------------------- Reporter: MichaelBurge | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: ApplicativeDo Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: 10892 | Blocking: Related Tickets: | Differential Rev(s): Phab:D4128 Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonmar): * differential: => Phab:D4128 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12143#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#12143: ApplicativeDo Fails to Desugar 'return True'
-------------------------------------+-------------------------------------
Reporter: MichaelBurge | Owner: simonmar
Type: bug | Status: new
Priority: normal | Milestone: 8.4.1
Component: Compiler | Version: 8.0.1
Resolution: | Keywords: ApplicativeDo
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: 10892 | Blocking:
Related Tickets: | Differential Rev(s): Phab:D4128
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Marlow

#12143: ApplicativeDo Fails to Desugar 'return True' -------------------------------------+------------------------------------- Reporter: MichaelBurge | Owner: simonmar Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: ApplicativeDo Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4128 Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonmar): * status: new => closed * resolution: => fixed * blockedby: 10892 => Comment: Probably shouldn't merge this into the stable branch because it changes inferred types. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/12143#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC