cabal-install-3.10.1.0: The command-line interface for Cabal and Hackage.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Distribution.Client.CmdRepl

Description

cabal-install CLI command: repl

Synopsis

The repl CLI and action

replAction :: NixStyleFlags (ReplOptions, EnvFlags) -> [String] -> GlobalFlags -> IO () Source #

The repl command is very much like build. It brings the install plan up to date, selects that part of the plan needed by the given or implicit repl target and then executes the plan.

Compared to build the difference is that only one target is allowed (given or implicit) and the target type is repl rather than build. The general plan execution infrastructure handles both build and repl targets.

For more details on how this works, see the module Distribution.Client.ProjectOrchestration

Internals exposed for testing

selectPackageTargets :: TargetSelector -> [AvailableTarget k] -> Either ReplTargetProblem [k] Source #

This defines what a TargetSelector means for the repl command. It selects the AvailableTargets that the TargetSelector refers to, or otherwise classifies the problem.

For repl we select:

  • the library if there is only one and it's buildable; or
  • the exe if there is only one and it's buildable; or
  • any other buildable component.

Fail if there are no buildable lib/exe components, or if there are multiple libs or exes.

selectComponentTarget :: SubComponentTarget -> AvailableTarget k -> Either ReplTargetProblem k Source #

For a TargetComponent TargetSelector, check if the component can be selected.

For the repl command we just need the basic checks on being buildable etc.