From 0912e45b1fe31e17c5a528701a0c5a0812867cc7 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Tue, 12 Mar 2019 16:05:26 +0200 Subject: [PATCH] SkipDocker data constructor never used --- src/Stack/Runners.hs | 32 +++++++++++++------------------- src/Stack/Types/Config.hs | 7 ------- src/main/Main.hs | 1 - 3 files changed, 13 insertions(+), 27 deletions(-) diff --git a/src/Stack/Runners.hs b/src/Stack/Runners.hs index 37866a5b16..4bb4fccf40 100644 --- a/src/Stack/Runners.hs +++ b/src/Stack/Runners.hs @@ -141,7 +141,7 @@ withDefaultBuildConfigAndLock -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withDefaultBuildConfigAndLock go inner = - withBuildConfigExt WithDocker go AllowNoTargets defaultBuildOptsCLI Nothing inner Nothing + withBuildConfigExt go AllowNoTargets defaultBuildOptsCLI Nothing inner Nothing withBuildConfigAndLock :: GlobalOpts @@ -150,7 +150,7 @@ withBuildConfigAndLock -> (Maybe FileLock -> RIO EnvConfig ()) -> IO () withBuildConfigAndLock go needTargets boptsCLI inner = - withBuildConfigExt WithDocker go needTargets boptsCLI Nothing inner Nothing + withBuildConfigExt go needTargets boptsCLI Nothing inner Nothing -- | A runner specially built for the "stack clean" use case. For some -- reason (hysterical raisins?), all of the functions in this module @@ -171,8 +171,7 @@ withCleanConfig go inner = runRIO bconfig inner withBuildConfigExt - :: WithDocker - -> GlobalOpts + :: GlobalOpts -> NeedTargets -> BuildOptsCLI -> Maybe (RIO Config ()) @@ -189,7 +188,7 @@ withBuildConfigExt -- available in this action, since that would require build tools to be -- installed on the host OS. -> IO () -withBuildConfigExt skipDocker go@GlobalOpts{..} needTargets boptsCLI mbefore inner mafter = loadConfigWithOpts go $ \lc -> do +withBuildConfigExt go@GlobalOpts{..} needTargets boptsCLI mbefore inner mafter = loadConfigWithOpts go $ \lc -> do withUserFileLock go (view stackRootL lc) $ \lk0 -> do -- A local bit of state for communication between callbacks: curLk <- newIORef lk0 @@ -212,20 +211,15 @@ withBuildConfigExt skipDocker go@GlobalOpts{..} needTargets boptsCLI mbefore inn let getCompilerVersion = loadCompilerVersion go lc runRIO (lcConfig lc) $ - case skipDocker of - SkipDocker -> do - forM_ mbefore id - Nix.reexecWithOptionalShell (lcProjectRoot lc) getCompilerVersion (inner'' lk0) - forM_ mafter id - WithDocker -> Docker.reexecWithOptionalContainer - (lcProjectRoot lc) - mbefore - (runRIO (lcConfig lc) $ - Nix.reexecWithOptionalShell (lcProjectRoot lc) getCompilerVersion (inner'' lk0)) - mafter - (Just $ liftIO $ - do lk' <- readIORef curLk - munlockFile lk') + Docker.reexecWithOptionalContainer + (lcProjectRoot lc) + mbefore + (runRIO (lcConfig lc) $ + Nix.reexecWithOptionalShell (lcProjectRoot lc) getCompilerVersion (inner'' lk0)) + mafter + (Just $ liftIO $ + do lk' <- readIORef curLk + munlockFile lk') -- | Load the configuration. Convenience function used -- throughout this module. diff --git a/src/Stack/Types/Config.hs b/src/Stack/Types/Config.hs index 9f2ac0c7df..eff74f636b 100644 --- a/src/Stack/Types/Config.hs +++ b/src/Stack/Types/Config.hs @@ -81,9 +81,6 @@ module Stack.Types.Config ,defaultLogLevel -- ** LoadConfig ,LoadConfig(..) - -- ** WithDocker - ,WithDocker(..) - -- ** Project & ProjectAndConfigMonoid ,Project(..) ,Curator(..) @@ -495,10 +492,6 @@ data BuildConfig = BuildConfig , bcCurator :: !(Maybe Curator) } -data WithDocker - = SkipDocker - | WithDocker - stackYamlL :: HasBuildConfig env => Lens' env (Path Abs File) stackYamlL = buildConfigL.lens bcStackYaml (\x y -> x { bcStackYaml = y }) diff --git a/src/main/Main.hs b/src/main/Main.hs index 53834746e6..9c805ff0ff 100644 --- a/src/main/Main.hs +++ b/src/main/Main.hs @@ -992,7 +992,6 @@ imgDockerCmd :: (Bool, [Text]) -> GlobalOpts -> IO () imgDockerCmd (rebuild,images) go@GlobalOpts{..} = loadConfigWithOpts go $ \lc -> do let mProjectRoot = lcProjectRoot lc withBuildConfigExt - WithDocker go NeedTargets defaultBuildOptsCLI