Distribution.Client.CmdBench

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

Safe Haskell | None
Language | Haskell2010

Distribution.Client.CmdBench

Contents

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

Description

cabal-install CLI command: bench

Synopsis

- benchCommand :: CommandUI (NixStyleFlags ())
- benchAction :: NixStyleFlags () -> [String] -> GlobalFlags -> IO ()
- componentNotBenchmarkProblem :: PackageId -> ComponentName -> TargetProblem BenchProblem
- isSubComponentProblem :: PackageId -> ComponentName -> SubComponentTarget -> TargetProblem BenchProblem
- noBenchmarksProblem :: TargetSelector -> TargetProblem BenchProblem
- selectPackageTargets :: TargetSelector -> [AvailableTarget k] -> Either BenchTargetProblem [k]
- selectComponentTarget :: SubComponentTarget -> AvailableTarget k -> Either BenchTargetProblem k

# The `bench` CLI and action

benchCommand :: CommandUI (NixStyleFlags ()) #

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

The `build` command does a lot. It brings the install plan up to date, selects that part of the plan needed by the given or implicit targets and then executes the plan.

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

# Internals exposed for testing

componentNotBenchmarkProblem :: PackageId -> ComponentName -> TargetProblem BenchProblem #

isSubComponentProblem :: PackageId -> ComponentName -> SubComponentTarget -> TargetProblem BenchProblem #

noBenchmarksProblem :: TargetSelector -> TargetProblem BenchProblem #

selectPackageTargets :: TargetSelector -> [AvailableTarget k] -> Either BenchTargetProblem [k] #

This defines what a `TargetSelector` means for the `bench` command. It selects the `AvailableTarget`s that the `TargetSelector` refers to, or otherwise classifies the problem.

For the `bench` command we select all buildable benchmarks, or fail if there are no benchmarks or no buildable benchmarks.

selectComponentTarget :: SubComponentTarget -> AvailableTarget k -> Either BenchTargetProblem k #

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

For the `bench` command we just need to check it is a benchmark, in addition to the basic checks on being buildable etc.