haskell / haskell/cabal

Semantics of index-state in cabal.project

Open
#8,568 26 comments 0 reactions 0 assignees View on GitHub
re: package index re: project-file type: discussion
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

At IOG we have started using a custom hackage repositories, which we informally call [CHaP](https://input-output-hk.github.io/cardano-haskell-packages/).

To add the custom repository to a project we have been doing

```
repository cardano-haskell-packages
url: https://input-output-hk.github.io/cardano-haskell-packages
secure: True
root-keys:
-- snip

index-state: 2022-07-01T00:00:00Z
index-state: cardano-haskell-packages 2022-10-20T00:00:00Z
```

We thought the first `index-state` would apply to all active repositories, and the second one only to the specified repository. (For context: we did this because we were working around a limination with another tool which we use to parse `cabal.project`).

But we were wrong! After a while it became clear that the second index-state completely overrides the first (as the first was never there).

Indeed, the correct way to express two index-states would be
```
index-state:
, hackage.haskell.org 2022-07-01T00:00:00Z
, cardano-haskell-packages 2022-10-20T00:00:00Z
```

1. Is this the intended behaviour?
2. Should cabal accept multiple `index-state` stanza (for different repos)
3. Should cabal give a warning when it sees stanzas which override previos ones?

Thanks!

Ping @michaelpj @angerman

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.