haskell / haskell/cabal

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

Open
#5,530 5 comments 0 reactions 0 assignees View on GitHub
Cabal: Backpack Cabal: common stanza type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.