Skip to content

implicit common stanzas (a.k.a. common blocks) #5530

Open
@daig

Description

@daig

It would be nice to be able to avoid writing the same imports everywhere - this becomes relevant as backpack encourages many internal libraries with similar cabal properties.

The most general way I can imagine is common import blocks that would look something like

import: my-common
   library lib-a
        ...
    library lib-b
        ...
    test-suite test-a
        ...

where each piece within the indented scope implicitly imports my-common.

another possibility with even less boilerplate at the cost of being less general is to have toplevel implicit imports like

library-common
    build-depends: base
    ...

so that all libraries import it. There'd also be similar constructs for executable, test-suite, benchmark, foreign-library, etc.

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