withBuildSettings :: [String] -> (BuildSettings -> BuildPlan -> IO a) -> IO a
withBuildSettings args f = do
    version <- getGhcVersion
    BuildArgs {..} <- parseBuildArgs version args
    bp <- readBuildPlan buildPlanSrc
    let bs = defaultBuildSettings buildCores version
        modTestThreads settings' =
            case testThreads of
                Nothing -> settings'
                Just t -> settings' { testWorkerThreads = t }
        settings = modTestThreads bs
            { sandboxRoot = sandbox
            , extraArgs = extraArgs' . extraArgs bs
            , buildDocs = not noDocs
            }
    f settings bp
withBuildSettings :: [String] -> (BuildSettings -> BuildPlan -> IO a) -> IO a
withBuildSettings args f = do
    version <- getGhcVersion
    BuildArgs {..} <- parseBuildArgs version args
    bp <- readBuildPlan buildPlanSrc
    let bs = defaultBuildSettings buildCores version
        modTestThreads settings' =
            case testThreads of
                Nothing -> settings'
                Just t -> settings' { testWorkerThreads = t }
        settings = modTestThreads bs
            { sandboxRoot = sandbox
            , extraArgs = extraArgs' . extraArgs bs
            , buildDocs = not noDocs
            }
    f settings bp
withBuildSettings args f = do
    version <- getGhcVersion
    BuildArgs {..} <- parseBuildArgs version args
    bp <- readBuildPlan buildPlanSrc
    let bs = defaultBuildSettings buildCores version
        modTestThreads settings' =
            case testThreads of
                Nothing -> settings'
                Just t -> settings' { testWorkerThreads = t }
        settings = modTestThreads bs
            { sandboxRoot = sandbox
            , extraArgs = extraArgs' . extraArgs bs
            , buildDocs = not noDocs
            }
    f settings bp