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