[Haskell-cafe] Imports in complex Setup.hs -- should we encourage/require PackageImports?
jmillikin at gmail.com
Tue May 24 00:08:23 CEST 2011
Several libraries (notably Pandoc and Gtk2hs) have very complex Setup.hs
scripts, which import several external libraries. In my experience, these
imports are very fragile, because Cabal does not enforce package visibility
in Setup.hs. For example, a Setup.hs that imports Control.Monad.Trans will
break if "monads-tf" is installed, and one that imports System.FilePath will
break if "system-filepath" is installed.
My typical solution when this happens is to manually tweak the GHC package
database before installing, but this is annoying and does not help other
users. Based on a ticket in Cabal's Trac <
http://hackage.haskell.org/trac/hackage/ticket/326 >, custom Setup.hs
scripts are discouraged by the Cabal developers. I assume this means there
will not be much development effort put towards an integrated solution (such
as using -hide-all-packages and build-depends: when compiling Setup.hs).
A possible solution is to ask developers with complex Setup.hs requirements
to use the PackageImports language extension when importing external
libraries. However, this places a burden on such developers, and I don't
know if it's portable to non-GHC compilers. It would also need an analysis
of currently published Hackage packages to see which have such scripts.
Any ideas/comments? Has anyone by chance found a good solution to this?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe