Skip to content

Globbing support for mixins and rexported-modules #7290

Open
@ekmett

Description

@ekmett

Describe the bug
Using backpack often requires using large large numbers of reexported-modules stanzas and mixins stanzas.

If you use a backpack package and that package produces 17 outputs in some namespace, I have to repeat myself 17 times in the output to rename it in the mixins statement, and another 17 times in the rexported-modules stanza.

If I then go to use that backpack package 17x on another than provides 17 definitions, I'm now stuck with 289, and the exponent keeps growing from there. I'm currently using a program to produce my cabal files. This is not "the Way".

I don't want to use a custom setup to produce the boilerplate, because @phadej will be mad at me, but also because it gets in the way of incremental recompilation in this mode, as I understand the world.

This is currently the biggest blocker I have to using backpack 'in bulk' in my code.

I'd like to be able to rename in the mixins statement on the provides/requires sides with a wildcard notation of some sort:

in a sort of Makefile-like vocabulary:

consDefs (% as Foo.%) requires (% as Baz.%)

or since lowercase identifiers aren't a thing:

mixins: consDefs (x as Foo.x) requires (x as Baz.x)

or

mixins: consDefs (* as Foo.*) requires (* as Baz.*)

which gives an option of allowing recursive globbing or not

mixins: consDefs (** as Foo.**) requires (** as Baz.**)

Similarly,

reexported-modules:
  Foo.x as Bar.Internal.x

is practically required, as I have to re-export the things I get from all these bulk-work backpack modules.

options include using * and ** for recursive globbing or not. Other options are using something like a scheme like parameter pack syntax. I don't care what the syntax is, I just want something.

This would require cabal to be able to query a backpacked package for what signatures it has outstanding.

To Reproduce
Try to write large backpacked packages.

Alternatives explored
I am currently generating the entire cabal file with software, like I do with the gl package.

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