
#9191: Semi-exported names -------------------------------------+------------------------------------ Reporter: dfeuer | Owner: Type: feature request | Status: new Priority: low | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Description changed by dfeuer: Old description:
It's generally inadvisable to add exports to a well-known module because they may clash with existing code using the module and importing it in its entirety. As a work-around, I propose allowing a module to export a name that will only be visible in a module that lists it explicitly. Something approximately like
module Foo (a, b, explicit c)
simply
import Foo
would not bring c into scope, but
import Foo (c)
would bring in c (and nothing else). To get everything, we could use something like
import Foo revealing (c)
and to be a bit picky,
import Foo hiding (a) revealing (c).
New description: It's generally inadvisable to add exports to a well-known module because they may clash with existing code using the module and importing it in its entirety. As a work-around, I propose allowing a module to export a name that will only be visible in a module that lists it explicitly. If we had module Foo (a, b, hidden c) then simply import Foo would not bring c into scope, but import Foo (c) would bring in c (and nothing else). To get everything, we could use something like import Foo revealing (c) and to be a bit picky, import Foo hiding (a) revealing (c). -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9191#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler