haskell / haskell/cabal

`--repl-multi-file` doesn't seem to play nice with older versions of GHC

Open
#10,209 0 comments 0 reactions 0 assignees View on GitHub
needs triage type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

I am trying to use `--repl-multi-file` to simplify `cabal-doctest` (https://github.com/sol/doctest/issues/428) and make it more robust.

The documentation of `--repl-multi-file` states:

> Write repl options to this directory rather than starting repl mode

Given this, I would assume that

```
$ cabal repl -w $GHC
```
and

```
$ cabal repl --repl-multi-file ./tmp -w $GHC
$ $GHC --interactive `cat ./tmp/*-inplace`
```

are essentially equivalent.

However, this doesn't seem to be the case. While the earlier works for a wide range of GHC versions, the later does not work with versions of GHC older than 9.4.*.

**To Reproduce**

```
$ git clone https://github.com/sol/markdown-unlit && cd markdown-unlit
```

```
$ GHC=ghc-9.2.8
```

```
$ cabal repl -w $GHC
```

```
$ cabal repl --repl-multi-file . --keep-temp-files -w $GHC
```
```
$ $GHC --interactive `cat markdown-unlit-0.6.0-inplace`
...
ghc: unrecognised flag: -this-package-name
...
```

**Expected behavior**

```
$ cabal repl -w $GHC
```
and
```
$ cabal repl --repl-multi-file ./tmp -w $GHC
$ $GHC --interactive `cat ./tmp/*-inplace`
```
behave the same, at least in a none-multi-repl scenario.

**System information**

`cabal-install-3.12.1.0`

Contributor guide

Open the contributing guide

Research direction

Start with the `cabal repl --repl-multi-file` path and reproduce the markdown-unlit example using GHC 9.2.8 and cabal-install-3.12.1.0. Compare its generated options with direct `cabal repl` and verify that invoking `$GHC --interactive` from the generated `*-inplace` file behaves equivalently on older GHC versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.