什么是 cabal 组件,我该如何使用它们?

What are cabal components and how do I use them?

cabal build --help 和其他人在

这样的句子中提到 components
Build one or more targets from within the project. The available targets are   
the packages in the project as well as individual components within those
packages, including libraries, executables, test-suites or benchmarks. Targets
can be specified by name or location. If no target is specified then the
default is to build the package in the current directory.

来自 cabal user guide9. Setup.hs Commands 中也提到了它们,并且 给 select 两个前缀 exe:lib:。还有更多这样的前缀吗?

一个组件是一个节后面的任何东西,它有自己的一组依赖关系等。所以它可以是多个子库,多个可执行文件,test-suites,等等

你是对的,这没有被记录下来!在源码中我们可以看到如下(https://github.com/haskell/cabal/blob/00a2351789a460700a2567eb5ecc42cca0af913f/Cabal/src/Distribution/Simple/BuildTarget.hs#L569)

matchComponentKind :: String -> Match ComponentKind
matchComponentKind s
  | s `elem` ["lib", "library"]                 = return' LibKind
  | s `elem` ["flib", "foreign-lib", "foreign-library"] = return' FLibKind
  | s `elem` ["exe", "executable"]              = return' ExeKind
  | s `elem` ["tst", "test", "test-suite"]      = return' TestKind
  | s `elem` ["bench", "benchmark"]             = return' BenchKind
  | otherwise = matchErrorExpected "component kind" s
  where
    return' ck = increaseConfidence >> return ck

这就是完整列表!