cabal-install-3.12.1.0: The command-line interface for Cabal and Hackage.

Safe Haskell | None
Language | Haskell2010

Distribution.Client.CmdRepl

Contents

- The `repl` CLI and action
- Internals exposed for testing

Description

cabal-install CLI command: repl

Synopsis

- replCommand :: CommandUI (NixStyleFlags ReplFlags)
- replAction :: NixStyleFlags ReplFlags -> [String] -> GlobalFlags -> IO ()
- data ReplFlags = ReplFlags {
  - configureReplOptions :: ReplOptions
  - replEnvFlags :: EnvFlags
  - replUseMulti :: Flag Bool
  - replKeepTempFiles :: Flag Bool
  }
- matchesMultipleProblem :: MultiReplDecision -> TargetSelector -> [AvailableTarget ()] -> ReplTargetProblem
- selectPackageTargets :: MultiReplDecision -> TargetSelector -> [AvailableTarget k] -> Either ReplTargetProblem [k]
- selectComponentTarget :: SubComponentTarget -> AvailableTarget k -> Either ReplTargetProblem k
- data MultiReplDecision = MultiReplDecision {
  - compilerVersion :: Maybe Version
  - enabledByFlag :: Bool
  }

# The `repl` CLI and action

replCommand :: CommandUI (NixStyleFlags ReplFlags) #

replAction :: NixStyleFlags ReplFlags -> [String] -> GlobalFlags -> IO () #

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 multiple targets are handled specially 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

data ReplFlags #

Constructors

ReplFlags |
Fields configureReplOptions :: ReplOptions replEnvFlags :: EnvFlags replUseMulti :: Flag Bool replKeepTempFiles :: Flag Bool

#### Instances

Instances details

Monoid ReplFlags # |
Instance details Defined in Distribution.Client.ReplFlags Methods mempty :: ReplFlags # mappend :: ReplFlags -> ReplFlags -> ReplFlags # mconcat :: [ReplFlags] -> ReplFlags #
Semigroup ReplFlags # |
Instance details Defined in Distribution.Client.ReplFlags Methods (<>) :: ReplFlags -> ReplFlags -> ReplFlags # sconcat :: NonEmpty ReplFlags -> ReplFlags # stimes :: Integral b => b -> ReplFlags -> ReplFlags #

# Internals exposed for testing

matchesMultipleProblem :: MultiReplDecision -> TargetSelector -> [AvailableTarget ()] -> ReplTargetProblem #

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

This defines what a `TargetSelector` means for the `repl` command. It selects the `AvailableTarget`s 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 #

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.

data MultiReplDecision #

Constructors

MultiReplDecision |
Fields compilerVersion :: Maybe Version enabledByFlag :: Bool

#### Instances

Instances details

Show MultiReplDecision # |
Instance details Defined in Distribution.Client.CmdRepl Methods showsPrec :: Int -> MultiReplDecision -> ShowS # show :: MultiReplDecision -> String # showList :: [MultiReplDecision] -> ShowS #
Eq MultiReplDecision # |
Instance details Defined in Distribution.Client.CmdRepl Methods (==) :: MultiReplDecision -> MultiReplDecision -> Bool # (/=) :: MultiReplDecision -> MultiReplDecision -> Bool #