Skip to content

Flags for dependencies #4853

Closed
Closed
@clintonmead

Description

@clintonmead

This is kind of a feature request, but I was planning to do the patch myself, but I'm seeking advice about whether this is worth me contributing or is just a dumb idea I shouldn't even attempt.

My idea is that you could add flags to dependencies. For example, instead of just

blah >= 2.0

You could do:

blah(aflag) >= 2.0

When compiling a package dependency, all the flags will be collected together and then passed as if they were passed directly on the command line.

Packages will be recompiled under the following two circumstances:

  1. The version is changed (as currently) OR
  2. A flag is required which is not in the currently compiled version

I realise that package authors could use this feature to break things, but package authors have to be largely trusted anyway, as they can upload executable code. The primary use case I've got in mind currently for this is to avoid orphan instances without huge lists of dependencies being the result, but there may be other uses. These flags would trigger additional dependencies in the cabal file and instances in the code only when they are explicitly required.

My question here is this sometime that's worth my time having a go at or is it a monumentally stupid idea that I shouldn't even attempt to write a patch for? And if the former, any tips? And if the latter, why not and are there any alternative solutions?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions