[Haskell-cafe] export question (GHC.Handle)

Bertram Felgenhauer bertram.felgenhauer at googlemail.com
Thu Apr 17 10:46:59 EDT 2008

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 (
) where

import Hello.Impl
module Hello.Impl (
) 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.



More information about the Haskell-Cafe mailing list