Re: Hiding module *exports*
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 I like symmetry. +1 from me. - -- Alexander alexan...@plaimi.net https://secure.plaimi.net/~alexander -BEGIN PGP SIGNATURE- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iF4EAREIAAYFAlRN/y8ACgkQRtClrXBQc7WR4AD/f6AXDZyAMk/oyn2SaVDigPr7 Xi/psgHQ+aoNKENSJLEA/13bfUPgW9sAaDNy+PwQ5QQb4PPcDE8NK/sVe3DVRXFJ =nXtH -END PGP SIGNATURE- ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Hiding module *exports*
On 2014-10-26 at 20:28:41 +0100, Tom Murphy wrote: [...] 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. I'm generally +1 on this, and I even suggested that one myself some time ago: http://www.haskell.org/pipermail/haskell-prime/2014-January/003910.html Cheers, hvr ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Hiding module *exports*
+1 from me I was looking for the feature a few times. On 26 October 2014 19:28, Tom Murphy amin...@gmail.com wrote: (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 ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users -- *Λ\ois* http://twitter.com/aloiscochard http://github.com/aloiscochard ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Hiding module *exports*
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 ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Hiding module *exports*
Hi Tom, +1 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. I would be surprised if 'Foo(..)' would mean in this case something different, so yes, the type Foo should be hidden too. Greetings, Daniel ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Hiding module *exports*
On Mon, Oct 27, 2014 at 2:41 PM, Daniel Trstenjak daniel.trsten...@gmail.com wrote: 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. I would be surprised if 'Foo(..)' would mean in this case something different, so yes, the type Foo should be hidden too. One related question: how would you export only the type if you have newtype Foo = Foo ... which is a pretty common pattern? Since hiding (Foo(Foo)) would also hide the type, I don't see many options, which is unfortunate. In general, I'm +1 on the proposal. Erik ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Hiding module *exports*
El Oct 27, 2014, a las 7:42, Herbert Valerio Riedel h...@gnu.org escribió: 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 Right -- hiding a type necessarily hides its constructors (and importing a constructor necessarily imports its type), which actually implies an obvious semantics. So there's less to bikeshed than I had thought. Tom ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Hiding module *exports*
El Oct 27, 2014, a las 9:57, Erik Hesselink hessel...@gmail.com escribió: On Mon, Oct 27, 2014 at 2:41 PM, Daniel Trstenjak daniel.trsten...@gmail.com wrote: 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. I would be surprised if 'Foo(..)' would mean in this case something different, so yes, the type Foo should be hidden too. One related question: how would you export only the type if you have newtype Foo = Foo ... which is a pretty common pattern? Since hiding (Foo(Foo)) would also hide the type, I don't see many options, which is unfortunate. In general, I'm +1 on the proposal. I'd say hiding (Foo) hides the type and constructor; hiding (Foo(Foo)) hides only the constructor. Tom Erik ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Hiding module *exports*
+1. On Sun, Oct 26, 2014 at 3:28 PM, Tom Murphy amin...@gmail.com wrote: (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 ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Hiding module *exports*
(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 ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Re: Hiding module *exports*
Strong +1 from me, this is *especially* annoying when you want to selectively re-export parts of a module from somewhere or in case of exports generated by TH. Cheers, Merijn On 26 Oct 2014, at 12:28, Tom Murphy amin...@gmail.com wrote: (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 ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users ___ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users