[GHC] #14249: ApplicativeDo: Pattern matching on a bind forces a Monad constraint

GHC ghc-devs at haskell.org
Mon Sep 18 23:26:54 UTC 2017


#14249: ApplicativeDo: Pattern matching on a bind forces a Monad constraint
--------------------------------------+---------------------------
           Reporter:  mutantmell      |             Owner:  (none)
               Type:  bug             |            Status:  new
           Priority:  normal          |         Milestone:
          Component:  Compiler        |           Version:  8.2.1
           Keywords:  ApplicativeDo   |  Operating System:  Linux
       Architecture:  x86_64 (amd64)  |   Type of failure:  Other
          Test Case:                  |        Blocked By:
           Blocking:                  |   Related Tickets:
Differential Rev(s):                  |         Wiki Page:
--------------------------------------+---------------------------
 Pattern matching on a bind in 8.2.1 confuses ApplicativeDo, and causes the
 type to have a Monad constraint where a Functor constraint would suffice.

 In GHC 8.0:

 {{{#!hs
 > :set -XApplicativeDo
 > :t \x -> do { (a, _) <- x; pure (a+1) }
 \x -> do { (a, _) <- x; pure (a+1) }
   :: (Num b, Functor f) => f (b, t) -> f b
 }}}

 In GHC 8.2:

 {{{#!hs
 > :set -XApplicativeDo
 > :t \x -> do { (a, _) <- x; pure (a+1) }
 \x -> do { (a, _) <- x; pure (a+1) }
   :: (Num b1, Monad m) => m (b1, b2) -> m b1
 }}}

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14249>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list