我尝试过向我的Setup.hs
添加一个构建挂钩,如下所示:
ourBuildHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> BuildFlags -> IO ()
ourBuildHook =
let
defaultBuildHook = buildHook simpleUserHooks
doBuild descr info hooks flags =
let
originalPaths = buildProgramPaths flags
originalArgs = buildProgramArgs flags
modifiedFlags = flags {
buildProgramPaths = originalPaths ++ [("yo", "dawg")],
buildProgramArgs = originalArgs ++ [("what", ["up"])],
buildVerbosity = flag verbose
}
in do
defaultBuildHook descr info hooks modifiedFlags
in
doBuild
main = defaultMainWithHooks simpleUserHooks { buildHook = ourBuildHook }
然后我运行cabal build
。
但是我发现buildProgramPaths
和buildProgramArgs
(buildVerbosity
defaultMainWithHooks
添加后,我看不到任何影响。这些字段实际上是由{{1}}使用的,还是被忽略了?