Hiding module *exports*
Herbert Valerio Riedel
hvr at gnu.org
Mon Oct 27 11:42:07 UTC 2014
On 2014-10-26 at 20:28:41 +0100, Tom Murphy wrote:
[...]
> 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.
PS: As for semantics, I'd suggest to have
module Foo hiding (Lockbox(MkLockbox), internalFunction) where
the same effect moving the definitions of `Foo` into an hidden/internal
module `_Foo` and having `Foo` re-export it in the following way:
module Foo (module _Foo) where
import _Foo hiding (Lockbox(MkLockbox), internalFunction)
that should result the least surprise IMHO
Cheers,
hvr
More information about the Glasgow-haskell-users
mailing list