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

GHC ghc-devs at haskell.org
Wed Jun 1 23:59:07 UTC 2016


#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


More information about the ghc-tickets mailing list