-XRebindableSyntax needs return?
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.
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.2 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |