packageBench' :: Bool -> Bool -> IDEPackage -> Bool -> (Bool -> IDEAction) -> IDEAction
packageBench' backgroundBuild jumpToWarnings package shallConfigure continuation = do
    let dir = ipdPackageDir package
    useStack <- liftIO . doesFileExist $ dir </> "stack.yaml"
    if "--enable-benchmarks" `elem` ipdConfigFlags package
        then do
          logLaunch <- getDefaultLogLaunch
          showDefaultLogLaunch'
          catchIDE (do
            prefs <- readIDE prefs
            let cmd=if useStack then "stack" else cabalCommand prefs
            let args=if useStack then ["bench"] else ["bench", "--with-ghc=leksahtrue"]
            runExternalTool' (__ "Benchmarking") cmd (args
                ++ ipdBuildFlags package ++ ipdBenchmarkFlags package) dir $ do
                    (mbLastOutput, isConfigErr, _) <- C.getZipSink $ (,,)
                        <$> C.ZipSink sinkLast
                        <*> C.ZipSink isConfigError
                        <*> (C.ZipSink $ logOutputForBuild package backgroundBuild jumpToWarnings)
                    lift $ do
                        errs <- readIDE errorRefs
                        if shallConfigure && isConfigErr
                            then
                                packageConfig' package (\ b ->
                                    when b $ packageBench' backgroundBuild jumpToWarnings package shallConfigure continuation)
                            else do
                                continuation (mbLastOutput == Just (ToolExit ExitSuccess))
                                return ())
            (\(e :: SomeException) -> print e)
        else continuation True
packageBench' :: Bool -> Bool -> IDEPackage -> Bool -> (Bool -> IDEAction) -> IDEAction
packageBench' backgroundBuild jumpToWarnings package shallConfigure continuation = do
    let dir = ipdPackageDir package
    useStack <- liftIO . doesFileExist $ dir </> "stack.yaml"
    if "--enable-benchmarks" `elem` ipdConfigFlags package
        then do
          logLaunch <- getDefaultLogLaunch
          showDefaultLogLaunch'
          catchIDE (do
            prefs <- readIDE prefs
            let cmd=if useStack then "stack" else cabalCommand prefs
            let args=if useStack then ["bench"] else ["bench", "--with-ghc=leksahtrue"]
            runExternalTool' (__ "Benchmarking") cmd (args
                ++ ipdBuildFlags package ++ ipdBenchmarkFlags package) dir $ do
                    (mbLastOutput, isConfigErr, _) <- C.getZipSink $ (,,)
                        <$> C.ZipSink sinkLast
                        <*> C.ZipSink isConfigError
                        <*> (C.ZipSink $ logOutputForBuild package backgroundBuild jumpToWarnings)
                    lift $ do
                        errs <- readIDE errorRefs
                        if shallConfigure && isConfigErr
                            then
                                packageConfig' package (\ b ->
                                    when b $ packageBench' backgroundBuild jumpToWarnings package shallConfigure continuation)
                            else do
                                continuation (mbLastOutput == Just (ToolExit ExitSuccess))
                                return ())
            (\(e :: SomeException) -> print e)
        else continuation True
packageBench' backgroundBuild jumpToWarnings package shallConfigure continuation = do
    let dir = ipdPackageDir package
    useStack <- liftIO . doesFileExist $ dir </> "stack.yaml"
    if "--enable-benchmarks" `elem` ipdConfigFlags package
        then do
          logLaunch <- getDefaultLogLaunch
          showDefaultLogLaunch'
          catchIDE (do
            prefs <- readIDE prefs
            let cmd=if useStack then "stack" else cabalCommand prefs
            let args=if useStack then ["bench"] else ["bench", "--with-ghc=leksahtrue"]
            runExternalTool' (__ "Benchmarking") cmd (args
                ++ ipdBuildFlags package ++ ipdBenchmarkFlags package) dir $ do
                    (mbLastOutput, isConfigErr, _) <- C.getZipSink $ (,,)
                        <$> C.ZipSink sinkLast
                        <*> C.ZipSink isConfigError
                        <*> (C.ZipSink $ logOutputForBuild package backgroundBuild jumpToWarnings)
                    lift $ do
                        errs <- readIDE errorRefs
                        if shallConfigure && isConfigErr
                            then
                                packageConfig' package (\ b ->
                                    when b $ packageBench' backgroundBuild jumpToWarnings package shallConfigure continuation)
                            else do
                                continuation (mbLastOutput == Just (ToolExit ExitSuccess))
                                return ())
            (\(e :: SomeException) -> print e)
        else continuation True