Cabal plugins

Antoine Latter aslatter at gmail.com
Fri Oct 21 23:19:48 CEST 2011


On Fri, Oct 21, 2011 at 3:49 PM, Jason Dagit <dagitj at gmail.com> wrote:
> On Fri, Oct 21, 2011 at 1:29 PM, Brent Yorgey <byorgey at seas.upenn.edu> wrote:
>> 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.
>

One thing that will be hard for plugins is that there's no way to get
at the package hooks without entering through Setup.main.

This means that if your plugin wants to, say, call haddock with
slightly tweaked arguments, you might miss something important that
the standard 'cabal haddock' would have gotten because it runs the
user hooks. (This concern only applies if your plugin is using the
Cabal library to open up the package description and root around and
do things).

There's probably still a lot you can do, though - something like
'cabal-dev' could be entirely written as a plugin (and I guess it
would be out-of-the-box: 'cabal dev configure' would 'just work' under
this proposal, although the help text would need to change).

Antoine



More information about the cabal-devel mailing list