[GHC] #11607: ApplicativeDo easily foiled with `pure`
#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
#11607: ApplicativeDo easily foiled with `pure` -------------------------------------+------------------------------------- Reporter: bgamari | Owner: Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | 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: | -------------------------------------+------------------------------------- Changes (by ocharles): * cc: ocharles (added) -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11607#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11607: ApplicativeDo easily foiled with `pure` -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: new Priority: high | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | 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: | -------------------------------------+------------------------------------- Changes (by bgamari): * owner: => bgamari -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11607#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11607: ApplicativeDo easily foiled with `pure` -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: patch Priority: high | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | 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): Phab:D1931 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch * differential: => Phab:D1931 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11607#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11607: ApplicativeDo easily foiled with `pure` -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: patch Priority: high | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: ApplicativeDo Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: ado/T11607 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1931 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * testcase: => ado/T11607 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11607#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11607: ApplicativeDo easily foiled with `pure` -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: patch Priority: high | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: ApplicativeDo Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: ado/T11607 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1931 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Yikes! there is no user-manual documentation about the magical behaviour of `return`. Adding more magic (`pure` or `return`) sees uncool. E.g. if I have {{{ }}} then using `blah` will surprisingly fail. Simon M? Regardless whatever the behaviour is ought to be carefully specified in the user manual. So I'm not complaining about Phab:D1931, but rather asking for proper documentation. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11607#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11607: ApplicativeDo easily foiled with `pure` -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: patch Priority: high | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: ApplicativeDo Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: ado/T11607 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1931 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"0c7db61f8a17b2c5c4335b62103eb9ffc5d24154/ghc" 0c7db61f/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="0c7db61f8a17b2c5c4335b62103eb9ffc5d24154" ApplicativeDo: Handle terminal `pure` statements ApplicativeDo handled terminal `return` statements properly, but not `pure`. Test Plan: Validate with included testcase Reviewers: austin, simonmar Reviewed By: austin, simonmar Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D1931 GHC Trac Issues: #11607 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11607#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11607: ApplicativeDo easily foiled with `pure` -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: merge Priority: high | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: | Keywords: ApplicativeDo Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: ado/T11607 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1931 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => merge -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11607#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11607: ApplicativeDo easily foiled with `pure` -------------------------------------+------------------------------------- Reporter: bgamari | Owner: bgamari Type: bug | Status: closed Priority: high | Milestone: 8.0.1 Component: Compiler (Type | Version: 8.0.1-rc2 checker) | Resolution: fixed | Keywords: ApplicativeDo Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: ado/T11607 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1931 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed * resolution: => fixed Comment: Merged as 32e2d58c8b767d791dd79f5e77f39a776f784054. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11607#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC