Skip to content

Default targets for REPL command with a project #11451

@philderbeast

Description

@philderbeast

Describe the feature request
With a project, allow cabal repl to default the target when none is given in these two cases:

  1. If there is only one package in the project use that as the target.
  2. If there is more than one package and --enable-multi-repl is an option then pick all as the target.

Additional context
When we are working with a package, cabal repl needs no target.

$ cabal unpack Cabal-syntax
Warning: this is a debug build of cabal-install with assertions enabled.
Downloading  Cabal-syntax-3.16.1.0
Downloaded   Cabal-syntax-3.16.1.0
Unpacking to Cabal-syntax-3.16.1.0/

$ cd Cabal-syntax-3.16.1.0/

$ cabal repl
Warning: this is a debug build of cabal-install with assertions enabled.
Resolving dependencies...
Build profile: -w ghc-9.12.2 -O1
In order, the following will be built (use -v for more details):
 - alex-3.5.4.0 (exe:alex) (requires build)
 - Cabal-syntax-3.16.1.0 (interactive) (lib) (first run)
Starting     alex-3.5.4.0 (exe:alex)
Building     alex-3.5.4.0 (exe:alex)
Installing   alex-3.5.4.0 (exe:alex)
Completed    alex-3.5.4.0 (exe:alex)
Warning: this is a debug build of cabal-install with assertions enabled.
Configuring library for Cabal-syntax-3.16.1.0...
Warning: this is a debug build of cabal-install with assertions enabled.
Preprocessing library for Cabal-syntax-3.16.1.0...
GHCi, version 9.12.2: https://www.haskell.org/ghc/  :? for help
when making flags consistent: warning: [GHC-74335] [-Winconsistent-flags]
    Ignoring optimization flags since they are experimental for the byte-code interpreter.
    Pass -fno-unoptimized-core-for-interpreter to enable this feature.

[  1 of 139] Compiling Distribution.Compat.Binary
...
[139 of 139] Compiling Distribution.InstalledPackageInfo
Ok, 139 modules loaded.
ghci> 

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