[Haskell-cafe] GHC API + Cabal API + Cabal version checks: is there a way out?
Yuri de Wit
ydewit at gmail.com
Fri Sep 6 16:22:56 CEST 2013
That's right, Roman, not knowing anything about it would be even better!
Here is the same dependency info in a different format.
I also noticed that cabal has a more complete implementation of Version.
Couldn't this also move/merged with base (I think there is already a
Version module in base or something like that).
On Fri, Sep 6, 2013 at 10:17 AM, Niklas Hambüchen <mail at nh2.me> wrote:
> On Fri 06 Sep 2013 22:52:40 JST, Roman Cheplyaka wrote:
> > The right solution for Cabal would be not to know anything about the
> > GHC's database format at all.
> >
> > GHC and cabal communicate via a command line interface (`ghc-pkg dump`
> > in our direction; `ghc-pkg update` in the other). So it would suffice to
> > have a library which implements parsing and printing of the package
> > description, and have that library shared between GHC and Cabal.
>
> You are right. This is better.
>
> GHC's dependency on cabal seems to actually be quite minimal!
>
> I did a quick grep:
>
> % grep -rI "import Distribution" --include "*.hs" --include "*.lhs*" .
> | grep -v "libraries/" | grep -v Setup.hs | grep -v Setup.lhs | grep -v
> utils/haddock
> ./utils/ghc-cabal/Main.hs:import Distribution.PackageDescription
> ./utils/ghc-cabal/Main.hs:import Distribution.PackageDescription.Check
> hiding (doesFileExist)
> ./utils/ghc-cabal/Main.hs:import
> Distribution.PackageDescription.Configuration
> ./utils/ghc-cabal/Main.hs:import Distribution.PackageDescription.Parse
> ./utils/ghc-cabal/Main.hs:import Distribution.System
> ./utils/ghc-cabal/Main.hs:import Distribution.Simple
> ./utils/ghc-cabal/Main.hs:import Distribution.Simple.Configure
> ./utils/ghc-cabal/Main.hs:import Distribution.Simple.LocalBuildInfo
> ./utils/ghc-cabal/Main.hs:import Distribution.Simple.Program
> ./utils/ghc-cabal/Main.hs:import Distribution.Simple.Program.HcPkg
> ./utils/ghc-cabal/Main.hs:import Distribution.Simple.Utils
> (defaultPackageDesc, writeFileAtomic, toUTF8)
> ./utils/ghc-cabal/Main.hs:import Distribution.Simple.Build
> (writeAutogenFiles)
> ./utils/ghc-cabal/Main.hs:import Distribution.Simple.Register
> ./utils/ghc-cabal/Main.hs:import Distribution.Text
> ./utils/ghc-cabal/Main.hs:import Distribution.Verbosity
> ./utils/ghctags/Main.hs:import Distribution.Simple.GHC (
> componentGhcOptions )
> ./utils/ghctags/Main.hs:import Distribution.Simple.Configure (
> getPersistBuildConfig )
> ./utils/ghctags/Main.hs:import Distribution.Simple.Compiler (
> compilerVersion )
> ./utils/ghctags/Main.hs:import Distribution.Simple.Program.GHC (
> renderGhcOptions )
> ./utils/ghctags/Main.hs:import Distribution.PackageDescription (
> library, libBuildInfo )
> ./utils/ghctags/Main.hs:import Distribution.Simple.LocalBuildInfo
> ./utils/ghc-pkg/Main.hs:import
> Distribution.InstalledPackageInfo.Binary()
> ./utils/ghc-pkg/Main.hs:import Distribution.ModuleName hiding (main)
> ./utils/ghc-pkg/Main.hs:import Distribution.InstalledPackageInfo
> ./utils/ghc-pkg/Main.hs:import Distribution.Compat.ReadP
> ./utils/ghc-pkg/Main.hs:import Distribution.ParseUtils
> ./utils/ghc-pkg/Main.hs:import Distribution.Package hiding (depends)
> ./utils/ghc-pkg/Main.hs:import Distribution.Text
> ./utils/ghc-pkg/Main.hs:import Distribution.Version
> ./compiler/ghci/Linker.lhs:import Distribution.Package hiding (depends,
> PackageId)
> ./compiler/main/Packages.lhs:import Distribution.InstalledPackageInfo
> ./compiler/main/Packages.lhs:import
> Distribution.InstalledPackageInfo.Binary
> ./compiler/main/Packages.lhs:import Distribution.Package hiding
> (PackageId,depends)
> ./compiler/main/PackageConfig.hs:import
> Distribution.InstalledPackageInfo
> ./compiler/main/PackageConfig.hs:import Distribution.ModuleName
> ./compiler/main/PackageConfig.hs:import Distribution.Package hiding
> (PackageId)
> ./compiler/main/PackageConfig.hs:import Distribution.Text
> ./compiler/main/PackageConfig.hs:import Distribution.Version
> ./compiler/main/Finder.lhs:import Distribution.Text
> ./compiler/main/Finder.lhs:import Distribution.Package hiding
> (PackageId)
>
> As you can see, there are only 4 files in ghc itself that depend on
> Cabal:
>
> ./compiler/ghci/Linker.lhs
> ./compiler/main/Packages.lhs
> ./compiler/main/PackageConfig.hs
> ./compiler/main/Finder.lhs
>
> (plus 1 file for ghc-pkg: ./utils/ghc-pkg/Main.hs)
>
> The ones in GHC core seem to rely only on quite basic data types.
>
> From this, I would boldly claim that people have spent more time making
> the GHC build system work with this Cabal dependency than it would take
> stripping it off!
>
> (In fact, I would try to do this right now if the GHC build system
> wouldn't take so long to compile even the smallest changes ...)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130906/077bd624/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ghc-2.png
Type: image/png
Size: 107375 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130906/077bd624/attachment.png>
More information about the Haskell-Cafe
mailing list