
Hi everyone, I'm working on some improvements to 'cabal init', the biggest of which is looking at imports in source files to guess an initial list of dependencies to populate the 'Build-depends:' field. I wanted to get some feedback on a design decision: what to do when we find multiple packages providing the same module? Suppose we find a source file with the line import Foo.Bar So we get the list of installed packages, and look for packages providing the Foo.Bar module. If there's only one, great! We just use that version of that package as a dependency (with a conservative upper bound guided by the PVP). However, I suspect that much of the time we will instead find something like this: Scenario A: foobar-0.3 foobar-0.4 foobar-0.4.1 Scenario B: foobar-0.3 wizbang-0.4 all providing Foo.Bar. In Scenario A, which do we pick as our dependency: (a) foobar >= 0.3 && < 0.5 (b) foobar >= 0.4 && < 0.5 (c) foobar >= 0.4.1 && < 0.5 Personally, I lean towards (b): the earliest version PVP-compatible with the latest available version. But I could in principle be convinced of any of these options. In Scenario B, do we: (a) arbitrarily pick a package (and generate a warning) (b) refuse to pick either package (and generate a warning)? (c) pick *both* and let the user clean up the mess later (and generate a warning)? I suppose (b) seems most sensible. It's possible no one really cares and it doesn't matter that much, which is also fine. =) -Brent

On Fri, Oct 21, 2011 at 1:29 PM, Brent Yorgey
Hi everyone,
I'm working on some improvements to 'cabal init', the biggest of which is looking at imports in source files to guess an initial list of dependencies to populate the 'Build-depends:' field. I wanted to get some feedback on a design decision: what to do when we find multiple packages providing the same module?
While cabal init is something I use, I would prefer to have a separate tool for calculating my build-depends field. Something that could suggest things for an existing cabal project, ideally. Then I could run that regularly during development to help me determine what my build-deps should be and cabal init could suggest I run it (or run it for me). While I'm suggesting features I would like, wouldn't it be great if cabal used the plugin RFC that Simon came up with? http://www.mail-archive.com/haskell-cafe@haskell.org/msg92770.html I think that interface is a great way to unify the tools that have sprung up around cabal such as cabal-dev and cab.
I suppose (b) seems most sensible.
I concur. Jason
participants (2)
-
Brent Yorgey
-
Jason Dagit