Hiding module *exports*

Tom Murphy amindfv at gmail.com
Sun Oct 26 19:28:41 UTC 2014


(Not to be confused with the "hiding import behavior" discussion also going
on)

--

Currently, I'm able to write "module Foo where" to export everything
defined in Foo.

If, though, I add to the module some definitions which I don't want to
export...

    data Lockbox = MkLockbox Int

    internalFunction = ...

...I then have to explicitly enumerate everything that I *do* want the
module to export, and add to that list each time I add to the module.

I propose that instead, we're able to simply say what we mean:

    module Foo hiding (Lockbox(MkLockbox), internalFunction) where

I think its semantics are immediately clear to the reader.

There's a little bit of bikeshedding that needs to happen (e.g. is "hiding
(Foo(..))" sufficient to hide the type Foo and not just its constructors),
but are people +1 on this? I've frequently wanted this behavior.

Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20141026/b443c93a/attachment.html>


More information about the Glasgow-haskell-users mailing list