#4501: RebindableSyntax does not imply NoImplicitPrelude
---------------------------------+------------------------------------------
    Reporter:  CoreyOConnor      |       Owner:              
        Type:  bug               |      Status:  new         
    Priority:  normal            |   Component:  Compiler    
     Version:  7.0.1             |    Keywords:              
    Testcase:                    |   Blockedby:              
          Os:  Unknown/Multiple  |    Blocking:              
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown
---------------------------------+------------------------------------------
 According to the documentation for `RebindableSyntax`:
 "`-XRebindableSyntax` implies `-XNoImplicitPrelude.`"

 I would expect using GHC with both `-XRebindableSyntax` and
 `-NoImplicitPrelude` to be equivalent to just using `-XRebindableSyntax`.

 However `NoImplicitPrelude` does not appear to be applied if
 `RebindableSyntax` is used. Furthermore, `NoImplicitPrelude` does not
 appear to have an effect if placed before `RebindableSyntax`.

 I would expect the Test.hs program to fail to compile with:
 {{{
 [1 of 1] Compiling Main             ( Test.hs, Test.o )

 Test.hs:4:8: Not in scope: `undefined'

 Test.hs:7:5: Not in scope: `>>'

 Test.hs:8:5: Not in scope: `return'
 }}}

 However the failure is actually:
 {{{
 [cocon...@toast Scratch]$ ghc --make Test
 [1 of 1] Compiling Main             ( Test.hs, Test.o )

 Test.hs:6:5:
     Ambiguous occurrence `fail'
     It could refer to either `Main.fail', defined at Test.hs:3:1
                           or `Prelude.fail', imported from Prelude
 }}}

 Placing an `NoImplicitPrelude` LANGUAGE pragma '''after''' the
 `RebindableSyntax` one produces the expected results.

 [http://new-www.haskell.org/ghc/docs/7.0.1/html/users_guide/syntax-
 extns.html#rebindable-syntax RebindableSyntax documentation]

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4501>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to