[GHC] #11547: Accessing shadowed definitions in GHCi

#11547: Accessing shadowed definitions in GHCi -------------------------------------+------------------------------------- Reporter: mniip | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Apparently GHCi creates a qualified namespace for each line it interprets, as can be observed with: {{{#!hs
data A = A data A = B :t A A :: Ghci3.A }}} Apparently accessing shadowed definitions in this way sometimes breaks GHCi: {{{#!hs let a = a let a = a :t Ghci7.a
<interactive>:1:1: error: • GHC internal error: ‘Ghci7.a’ is not in scope during type checking, but it passed the renamer tcl_env of environment: [] • In the expression: Ghci7.a }}} More specifically, complete reproduction instructions: {{{#!hs GHCi, version 8.1.20160205: http://www.haskell.org/ghc/ :? for help
let foo = foo :t Ghci1.foo Ghci1.foo :: t let foo = foo :t Ghci1.foo
<interactive>:1:1: error: • GHC internal error: ‘Ghci1.foo’ is not in scope during type checking, but it passed the renamer tcl_env of environment: [] • In the expression: Ghci1.foo }}} 7.10.2 (and 7.8.3 as verified over IRC by monochrom) appears to have a slightly different behavior. It seems it only creates namespaces for data/newtype/class declarations. Yet still, it fails with an error the first time but works completely fine thereafter: {{{#!hs
data A = A data A = A :t Ghci1.A Failed to load interface for ‘Ghci1’ no package key matching ‘interactive’ was found :t Ghci1.A Ghci1.A :: Ghci1.A }}}
7.6.3 uses a different approach to displaying out of scope names so the behavior doesn't apply: {{{#!hs
data A = A data A = B :t A A :: main::Interactive.A }}}
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11547 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

data A = A let f A = Int data A = XX :type f }}}
#11547: Accessing shadowed definitions in GHCi -------------------------------------+------------------------------------- Reporter: mniip | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Is it desirable: * To provide full access, using qualified names, to shadowed data types (and maybe values), or * To consistently ''not'' provide it? I rather assume the former. After all if you say {{{ then we have to print some sensible type for `f`, but it clearly can't mention the new data type `A`; it must somehow mention the old data type `A`. And then you might want to know more about that data type. So it would be good to document this behaviour, and to make it work consistently. I know how some, but not all, of the moving parts work, so I can advise. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11547#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11547: Accessing shadowed definitions in GHCi -------------------------------------+------------------------------------- Reporter: mniip | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mniip): If we choose to provide access to shadowed identifiers then, in the debugger, our environment gets littered by `Ghci#._result` and `Ghci#._exception`. Is that desirable? I think I have a patch that implements that, but it breaks the debugger tests because of the above. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11547#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11547: Accessing shadowed definitions in GHCi -------------------------------------+------------------------------------- Reporter: mniip | Owner: mniip Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by mniip): * owner: => mniip -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11547#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11547: Accessing shadowed definitions in GHCi -------------------------------------+------------------------------------- Reporter: mniip | Owner: mniip Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): D2447 Wiki Page: | -------------------------------------+------------------------------------- Changes (by mniip): * differential: => D2447 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11547#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11547: Accessing shadowed definitions in GHCi -------------------------------------+------------------------------------- Reporter: mniip | Owner: mniip Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2439 Wiki Page: | -------------------------------------+------------------------------------- Changes (by mniip): * differential: D2447 => Phab:D2439 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11547#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11547: Accessing shadowed definitions in GHCi -------------------------------------+------------------------------------- Reporter: mniip | Owner: mniip Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2447 Wiki Page: | -------------------------------------+------------------------------------- Changes (by mniip): * differential: Phab:D2439 => Phab:D2447 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11547#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11547: Accessing shadowed definitions in GHCi -------------------------------------+------------------------------------- Reporter: mniip | Owner: mniip Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2447 Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): The implementation is easy: delete code. But what is the user-facing specification? We need user-manual stuff explaining what all this `Ghci4.foo` stuff means. How would you know whether to say `:t Ghci2.foo` or `:t Ghci3.foo`? Can you list all the `foo` functions? Etc. Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11547#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11547: Accessing shadowed definitions in GHCi -------------------------------------+------------------------------------- Reporter: mniip | Owner: mniip Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2447 Wiki Page: | -------------------------------------+------------------------------------- Comment (by mniip): Well in the current implementation all `Ghci#.foo` bindings would show up in `:show bindings`, although it has been argued that they should be removed from there. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11547#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11547: Accessing shadowed definitions in GHCi
-------------------------------------+-------------------------------------
Reporter: mniip | Owner: mniip
Type: bug | Status: new
Priority: normal | Milestone:
Component: GHCi | Version: 8.0.1-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s): Phab:D2447
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Ben Gamari

#11547: Accessing shadowed definitions in GHCi -------------------------------------+------------------------------------- Reporter: mniip | Owner: mniip Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: GHCi | Version: 8.0.1-rc1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2447 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed * milestone: => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11547#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11547: Accessing shadowed definitions in GHCi -------------------------------------+------------------------------------- Reporter: mniip | Owner: mniip Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: GHCi | Version: 8.0.1-rc1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: #14052 | Differential Rev(s): Phab:D2447 Wiki Page: | -------------------------------------+------------------------------------- Changes (by osa1): * related: => #14052 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11547#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC