
I notice in the source for GHC.Handle that certain functions (e.g. fdToHandle_stat) are in the export list, but are not actually exported (at least, it seems you cannot import them). What mechanism causes these functions to be "hidden", and are they still accessible in some way? Graham

On Thu, Apr 17, 2008 at 2:09 AM, Graham Fawcett
I notice in the source for GHC.Handle that certain functions (e.g. fdToHandle_stat) are in the export list, but are not actually exported (at least, it seems you cannot import them). What mechanism causes these functions to be "hidden", and are they still accessible in some way?
Good question. I often need to export a name to other modules within the hierarchy, but without making them visible outside it. I've "solved" this problem by giving them funky names and adding a comment, but is there a more structured way to do this? A quick google hasn't found one yet. cheers, Fraser.

Fraser Wilson wrote:
Good question. I often need to export a name to other modules within the hierarchy, but without making them visible outside it. I've "solved" this problem by giving them funky names and adding a comment, but is there a more structured way to do this? A quick google hasn't found one yet.
Assuming you're writing a cabal package, you could separate the interface from the actual implementation: ------------------------------------------------------------------------ module Hello ( hello ) where import Hello.Impl ------------------------------------------------------------------------ module Hello.Impl ( hello, hello_internal ) where hello, hello_internal :: String hello = "Hello, world!" hello_internal = "The secret word is 'puddleplum'." ------------------------------------------------------------------------ and then list Hello.Impl under extra-modules instead of exposed-modules in the cabal file, which will hide it from external users. Internal users can just use Hello.Impl directly. HTH, Bertram

Graham Fawcett wrote:
I notice in the source for GHC.Handle that certain functions (e.g. fdToHandle_stat) are in the export list, but are not actually exported (at least, it seems you cannot import them). What mechanism causes these functions to be "hidden", and are they still accessible in some way?
which ghc version are you using, and which sources are you looking at? import GHC.Handle (fdToHandle_stat) works fine in ghc 6.8.2. In the base library shipped with ghc 6.6.1, it wasn't exported (or even defined). HTH, Bertram

On Thu, Apr 17, 2008 at 10:38 AM, Bertram Felgenhauer
Graham Fawcett wrote:
I notice in the source for GHC.Handle that certain functions (e.g. fdToHandle_stat) are in the export list, but are not actually exported (at least, it seems you cannot import them). What mechanism causes these functions to be "hidden", and are they still accessible in some way?
which ghc version are you using, and which sources are you looking at?
import GHC.Handle (fdToHandle_stat)
works fine in ghc 6.8.2. In the base library shipped with ghc 6.6.1, it wasn't exported (or even defined).
Ah, I was looking at GHC 6.8.2 sources, but I may have been running 6.6.1. PEBKAC, sorry for the noise. Graham
participants (3)
-
Bertram Felgenhauer
-
Fraser Wilson
-
Graham Fawcett