This repository was archived by the owner on Oct 7, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ import Development.Shake
4
4
import Development.Shake.Command
5
5
import Development.Shake.FilePath
6
6
import Control.Monad
7
- import Data.Maybe ( isNothing )
7
+ import Data.Maybe ( isNothing
8
+ , isJust
9
+ )
8
10
import Control.Monad.Extra ( whenMaybe )
9
11
import System.Directory ( findExecutable
10
12
, copyFile
@@ -56,19 +58,18 @@ cabalInstallHie versionNumber = do
56
58
installCabal :: Action ()
57
59
installCabal = do
58
60
-- try to find existing `cabal` executable with appropriate version
59
- cabalExeOk <- liftIO (findExecutable " cabal" ) >>= \ case
60
- Nothing -> return False
61
- Just _ -> do
62
- checkCabal
63
- return True
61
+ cabalExeOk <- do
62
+ c <- liftIO (findExecutable " cabal" )
63
+ when (isJust c) checkCabal
64
+ return $ isJust c
64
65
65
66
-- install `cabal-install` if not already installed
66
67
unless cabalExeOk $ execStackShake_ [" install" , " cabal-install" ]
67
68
68
69
-- | check `stack` has the required version
69
70
checkCabal :: Action ()
70
71
checkCabal = do
71
- cabalVersion <- trimmedStdout <$> execCabal [ " --numeric-version " ]
72
+ cabalVersion <- getCabalVersion
72
73
unless (checkVersion requiredCabalVersion cabalVersion) $ do
73
74
printInStars $ cabalInstallIsOldFailMsg cabalVersion
74
75
error $ stackExeIsOldFailMsg cabalVersion
You can’t perform that action at this time.
0 commit comments