Splitting Hackage Packages and re-exporting entire modules (with same module name)

All, I have decided it would be beneficial to split System.Crypto.Random and the rest of crypto-api into different packages. Is there I way I can create a package, "entropy", with System.Crypto.Random but continue to expose that module from crypto-api (allowing people who use that module some time to move)? If so, how? If not, does anyone else see value in this and how it can be added to the infrastructure? Cheers, Thomas

If you give the module a new name in the new package then the old
module can re-export all of the symbols in the new module.
In GHC I don't think there is a way for two packages to export the
same module and have them be recognized as the same thing, as far as I
know.
Antoine
On Tue, Jul 5, 2011 at 12:36 AM, Thomas DuBuisson
All,
I have decided it would be beneficial to split System.Crypto.Random and the rest of crypto-api into different packages. Is there I way I can create a package, "entropy", with System.Crypto.Random but continue to expose that module from crypto-api (allowing people who use that module some time to move)? If so, how? If not, does anyone else see value in this and how it can be added to the infrastructure?
Cheers, Thomas
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Antoine Latter wrote:
If you give the module a new name in the new package then the old module can re-export all of the symbols in the new module.
In GHC I don't think there is a way for two packages to export the same module and have them be recognized as the same thing, as far as I know.
Right, but you don't have to rename the module if you use the PackageImports extension. (Incidentally, this used by the haskell2010 ibrary, which is implemented in terms of base) http://haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#packag... So the following should work, assuming 'original' is a package exporting the Foo.Bar module. {-# LANGUAGE PackageImports #-} module Foo.Bar (module Original) where import "original" Foo.Bar as Original Best regards, Bertram

On Wed, Jul 13, 2011 at 10:31 AM, Bertram Felgenhauer
Antoine Latter wrote:
If you give the module a new name in the new package then the old module can re-export all of the symbols in the new module.
In GHC I don't think there is a way for two packages to export the same module and have them be recognized as the same thing, as far as I know.
Right, but you don't have to rename the module if you use the PackageImports extension. (Incidentally, this used by the haskell2010 ibrary, which is implemented in terms of base)
http://haskell.org/ghc/docs/latest/html/users_guide/syntax-extns.html#packag...
So the following should work, assuming 'original' is a package exporting the Foo.Bar module.
{-# LANGUAGE PackageImports #-} module Foo.Bar (module Original) where
import "original" Foo.Bar as Original
Best regards,
Bertram
The downside to this approach is that anyone trying to use the module in GHCi (or use the module in a non-Cabal setting) will need to manually hide one of the packages. Does anyone know if there is a way to make Cabal auto-hide a package after install without too much trickery? That might be more than you want to do. Antoine
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (3)
-
Antoine Latter
-
Bertram Felgenhauer
-
Thomas DuBuisson