Skip to content

ApplicativeDo: Pattern matching on a bind forces a Monad constraint

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:

> :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:

> :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
Trac metadata
Trac field Value
Version 8.2.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information