Open mpilgrem opened 2 months ago
In respect of Cabal (the library) repl
, it is undocumented (https://github.com/haskell/cabal/issues/8906) at https://cabal.readthedocs.io/en/stable/setup-commands.html. At the command line:
> stack --snapshot lts-12.0 runghc -- Setup.hs repl --help
Open an interpreter session for the given component.
Usage: Setup.hs repl [COMPONENT] [FLAGS]
If the current directory contains no package, ignores COMPONENT parameters and
opens an interactive interpreter session; if a sandbox is present, its package
database will be used.
Otherwise, (re)configures with the given or default flags, and loads the
interpreter with the relevant modules. For executables, tests and benchmarks,
loads the main module (and its dependencies); for libraries all exposed/other
modules.
The default component is the library itself, or the executable if that is the
only component.
Support for loading specific modules is planned but not implemented yet. For
certain scenarios, `Setup.hs exec -- ghci :l Foo` may be used instead. Note
that `exec` will not (re)configure and you will have to specify the location
of other modules, if required.
Flags for repl:
-h --help Show this help text
-v --verbose[=n] Control verbosity (n is 0--3, default verbosity level
is 1)
--builddir=DIR The directory where Cabal puts generated build files
(default dist)
--with-PROG=PATH give the path to PROG
--PROG-option=OPT give an extra option to PROG (no need to quote options
containing spaces)
--PROG-options=OPTS give extra options to PROG
Examples:
Setup.hs repl The first component in the package
Setup.hs repl foo A named component (i.e. lib, exe, test suite)
Setup.hs repl --ghc-options="-lstdc++" Specifying flags for interpreter
stack --snapshot nightly-2024-04-03 runghc -- Setup.hs repl --help
(GHC 9.8.2, Cabal-3.10.2.0
) is the same, except for:
--repl-no-load Disable loading of project modules at REPL
startup.
--repl-options=FLAG Use the option(s) for the repl
Motivation:
Is there a reason that Stack avoids the use of Cabal (the library)
repl
(from Cabal >= 2.2)?Context:
Stack.Build.ExecutePackage.realConfigAndBuild
(extracts):Stack.GhciCmd.ghciCmd
(extracts):Stack.GhciCmd.ghci
(extracts):History:
repl
that the Stack project did not want to emulate)