[GHC] #11607: ApplicativeDo easily foiled with `pure`
GHC
ghc-devs at haskell.org
Thu Feb 18 22:22:36 UTC 2016
#11607: ApplicativeDo easily foiled with `pure`
-------------------------------------+-------------------------------------
Reporter: bgamari | Owner:
Type: bug | Status: new
Priority: high | Milestone: 8.0.1
Component: Compiler | Version: 8.0.1-rc2
(Type checker) |
Keywords: ApplicativeDo | Operating System: Unknown/Multiple
Architecture: | Type of failure: GHC rejects
Unknown/Multiple | valid program
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
`ApplicativeDo` fails to desugar `do` blocks ending with `pure`. For
instance,
{{{#!hs
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
newtype MaybeA a = MaybeA (Maybe a)
deriving (Show, Functor, Applicative)
main = print $ do x <- MaybeA $ Just 42
pure x
}}}
However, if the final `pure` is changed to `return` things work as
expected.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11607>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list