[GHC] #14670: -XRebindableSyntax needs return?

GHC ghc-devs at haskell.org
Mon Jan 15 00:51:28 UTC 2018


#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.html
 #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


More information about the ghc-tickets mailing list