[GHC] #14670: -XRebindableSyntax needs return?

#14670: -XRebindableSyntax needs return? -------------------------------------+------------------------------------- Reporter: jackkelly | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.2 Keywords: | Operating System: Unknown/Multiple RebindableSyntax | Architecture: | Type of failure: GHC rejects Unknown/Multiple | valid program Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The documentation for -XRebindableSyntax ( https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts... #rebindable-syntax-and-the-implicit-prelude-import ) reads:
“Do” notation is translated using whatever functions (>>=), (>>), and fail, are in scope (not the Prelude versions). List comprehensions, mdo (The recursive do-notation), and parallel array comprehensions, are unaffected.
The following code fails to compile (also confirmed to fail on GHC 8.0.2): {{{ {-# LANGUAGE RebindableSyntax #-} module Lib where import Prelude (IO) foo :: IO () foo = do pure () }}} It fails with this error: {{{ /home/kel317/z/src/Lib.hs:9:3: error: Not in scope: ‘return’ Perhaps you want to add ‘return’ to the import list in the import of ‘Prelude’ (src/Lib.hs:5:1-19). | 9 | pure () | ^^^^^^^ }}} To my reading, either something funky is going on with the way the do- notation is desugared, or the documentation needs to be corrected. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14670 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14670: -XRebindableSyntax needs return? -------------------------------------+------------------------------------- Reporter: jackkelly | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: | RebindableSyntax Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | rebindable/T14670 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * testcase: => rebindable/T14670 * milestone: => 8.6.1 Comment: Indeed that is quite curious. My first thought was perhaps `ApplicativeDo` was involved, but it's not enabled. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14670#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14670: -XRebindableSyntax needs return? -------------------------------------+------------------------------------- Reporter: jackkelly | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: | RebindableSyntax Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | rebindable/T14670 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): I see that in `compiler/rename/RnExpr.hs` there's a "TODO: I don't know how to get this right for rebindable syntax", but I don't think any of that is supposed to be used without `ApplicativeDo`. I haven't yet been able to find a place where `ApplicativeDo` checking obviously leaks out elsewhere. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14670#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14670: -XRebindableSyntax needs return?
-------------------------------------+-------------------------------------
Reporter: jackkelly | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.2.2
Resolution: | Keywords:
| RebindableSyntax
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: GHC rejects | Test Case:
valid program | rebindable/T14670
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#14670: -XRebindableSyntax needs return? -------------------------------------+------------------------------------- Reporter: jackkelly | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: | RebindableSyntax Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | rebindable/T14670 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * owner: (none) => simonmar Comment: Simon: this is your bailiwick. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14670#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14670: -XRebindableSyntax needs return? -------------------------------------+------------------------------------- Reporter: jackkelly | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: | RebindableSyntax,ApplicativeDo Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | rebindable/T14670 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonmar): * keywords: RebindableSyntax => RebindableSyntax,ApplicativeDo -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14670#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14670: -XRebindableSyntax needs return? -------------------------------------+------------------------------------- Reporter: jackkelly | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: 8.10.1 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: | RebindableSyntax,ApplicativeDo Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | rebindable/T14670 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by osa1): * milestone: 8.8.1 => 8.10.1 Comment: Bumping milestones of low-priority tickets. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14670#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14670: -XRebindableSyntax needs return? -------------------------------------+------------------------------------- Reporter: jackkelly | Owner: simonmar Type: bug | Status: closed Priority: normal | Milestone: 8.10.1 Component: Compiler | Version: 8.2.2 Resolution: worksforme | Keywords: | RebindableSyntax,ApplicativeDo Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | rebindable/T14670 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by josef): * status: new => closed * resolution: => worksforme Comment: This is fixed. With the latest GHC I get: {{{ Lib.hs:9:3: error: • Variable not in scope: pure :: () -> IO () • Perhaps you want to add ‘pure’ to the import list in the import of ‘Prelude’ (Lib.hs:5:1-19). | 9 | pure () | ^^^^ }}} I'm closing this ticket. Reopen if you disagree. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14670#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14670: -XRebindableSyntax needs return? -------------------------------------+------------------------------------- Reporter: jackkelly | Owner: simonmar Type: bug | Status: closed Priority: normal | Milestone: 8.10.1 Component: Compiler | Version: 8.2.2 Resolution: worksforme | Keywords: | RebindableSyntax,ApplicativeDo Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | rebindable/T14670 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by jackkelly): This still fails for me on GHC 8.6.3, which is the latest I see on https://www.haskell.org/ghc . If I've missed a later version, or you've confirmed a fix on GHC HEAD, then please re-close: {{{ $ ghci Test.hs GHCi, version 8.6.3: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Test ( Test.hs, interpreted ) Test.hs:7:3: error: Not in scope: ‘return’ Perhaps you want to add ‘return’ to the import list in the import of ‘Prelude’ (Test.hs:4:1-19). 7 | pure () | ^^^^^^^ Failed, no modules loaded. Prelude> }}} {{{ $ cat Test.hs {-# LANGUAGE RebindableSyntax #-} module Test where import Prelude (IO) foo :: IO () foo = do pure () }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14670#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14670: -XRebindableSyntax needs return? -------------------------------------+------------------------------------- Reporter: jackkelly | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.10.1 Component: Compiler | Version: 8.2.2 Resolution: | Keywords: | RebindableSyntax,ApplicativeDo Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | rebindable/T14670 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by jackkelly): * owner: simonmar => (none) * status: closed => new * resolution: worksforme => -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14670#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14670: -XRebindableSyntax needs return? -------------------------------------+------------------------------------- Reporter: jackkelly | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.10.1 Component: Compiler | Version: 8.2.2 Resolution: fixed | Keywords: | RebindableSyntax,ApplicativeDo Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | rebindable/T14670 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by ulysses4ever): * status: new => closed * resolution: => fixed Comment: jackkelly, when josef wrote “latest GHC”, he probably meant HEAD, not the latest released version. This really works as expected with HEAD. It would be interesting to find out which commit fixed it. I tried ti `git bisect` but submodules don't cooperate with me (unsurprisingly). I got: {{{ fatal: repository '../hadrian.git' does not exist }}} I tried various combinations of `make clean` / `boot-configure` / `git submodules update --recursive`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14670#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC