haskell / haskell/cabal

`cabal repl --enable-multi-repl` failure when a package uses mixins.

Open
#11,300 1 comment 0 reactions 0 assignees View on GitHub
re: multi-repl type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

## Context

Consider three packages: Alice, Bob, and Spike. Alice is a normal package. Bob is a normal package that depends on Spike. Spike depends on Alice like so:

```
-- Spike.cabal
...
library
mixins:
Alice hiding (Alice.Foo)
```

```mermaid
graph LR;
Bob --> Spike;
Spike -->|via mixin| Alice;
```

All packages are listed in cabal.project:
```
packages:
./Alice
./Bob
./Spike
```

## Problem

If I run `cabal repl --enable-multi-repl all`, I get the following error:

```
Error:
Mix-in refers to non-existent library 'Alice'
(did you forget to add the package to build-depends?)
Error: [Cabal-7125]
Failed to build Spike-0.4.1 (which is required by exe:Bob from Bob-0.1.6). The failure occurred during the configure step.
```

## Gotchas

This is sometimes hard to reproduce. If I run `cabal repl --enable-multi-repl Bob`, Spike may get built successfully. Same with `cabal repl --enable-multi-repl Spike`, which usually works.

Furthermore, I don't understand it, but sometimes `cabal repl` decides it needs to rebuild dependencies. (Spuriously, in my view.) If Spike needs to get rebuilt, it'll likely fail again.

This example is taken from a much larger project with a deep tree of dependencies between the component packages. I don't know if it is easy to reproduce or not.

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.