[GHC] #10650: Can't define GHCi :def macro with NoImplicitPrelude on

#10650: Can't define GHCi :def macro with NoImplicitPrelude on -------------------------------------+------------------------------------- Reporter: | Owner: RyanGlScott | Status: new Type: bug | Milestone: Priority: normal | Version: 7.10.1 Component: GHCi | Operating System: Unknown/Multiple Keywords: | Type of failure: GHC rejects Architecture: | valid program Unknown/Multiple | Blocked By: Test Case: | Related Tickets: #8640 Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- GHCi is unusually prohibitive in typechecking {{{:def}}} macros when {{{NoImplicitPrelude}}} is enabled. Here's an example to illustrate what I mean: {{{ $ ghci -XNoImplicitPrelude GHCi, version 7.10.1: http://www.haskell.org/ghc/ :? for help λ> :def pf \str -> Prelude.return Prelude.$ ":! pointfree \"" Prelude.++ str Prelude.++ "\"" <interactive>:1:111: Not in scope: type constructor or class ‘String’ <interactive>:1:121: Not in scope: type constructor or class ‘IO’ <interactive>:1:124: Not in scope: type constructor or class ‘String’ }}} I can understand the functions being out-of-scope when {{{NoImplicitPrelude}}} is on, but the type errors don't make any sense to me, especially since {{{:t}}} seems to pick up on the types just fine: {{{ λ> :t Prelude.return Prelude.return :: GHC.Base.Monad m => a -> m a λ> :t "\"" "\"" :: [GHC.Types.Char] }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10650 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10650: Can't define GHCi :def macro with NoImplicitPrelude on -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #8640 | Differential Revisions: -------------------------------------+------------------------------------- Changes (by rwbarton): * keywords: => newcomer Comment: These references to `String` and `IO` are from the expression that is built in `InteractiveUI.defineMacro`, see the comment: {{{ -- > ghciStepIO . definition :: String -> IO String }}} `RdrName` is a name that is not necessarily bound to a particular module. In this setting in ghci it only makes sense to use the `String` from the real `Prelude`. I'm not terribly familiar with this part of the compiler, but I imagine it is an easy local fix in `defineMacro`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10650#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10650: Can't define GHCi :def macro with NoImplicitPrelude on -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.10.1 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: Type of failure: GHC rejects | Unknown/Multiple valid program | Test Case: Blocked By: | Blocking: Related Tickets: #8640 #10508 | Differential Rev(s): D:974 Wiki Page: | -------------------------------------+------------------------------------- Changes (by archblob): * differential: => D:974 * related: #8640 => #8640 #10508 Comment: Apparently the issue was fixed in HEAD by D:974 before this ticket even got created :). -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10650#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10650: Can't define GHCi :def macro with NoImplicitPrelude on -------------------------------------+------------------------------------- Reporter: RyanGlScott | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.0.1 Component: GHCi | Version: 7.10.1 Resolution: fixed | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: GHC rejects | Test Case: valid program | ghci/scripts/T10508 Blocked By: | Blocking: Related Tickets: #8640 #10508 | Differential Rev(s): Phab:D974 Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * status: new => closed * testcase: => ghci/scripts/T10508 * differential: D:974 => Phab:D974 * resolution: => fixed * milestone: => 8.0.1 Comment: Replying to [comment:2 archblob]:
Apparently the issue was fixed in HEAD by D:974 before this ticket even got created :).
Nice find! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10650#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC