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
44import Development.Shake.Command
55import Development.Shake.FilePath
66import Control.Monad
7- import Data.Maybe ( isNothing )
7+ import Data.Maybe ( isNothing
8+ , isJust
9+ )
810import Control.Monad.Extra ( whenMaybe )
911import System.Directory ( findExecutable
1012 , copyFile
@@ -56,19 +58,18 @@ cabalInstallHie versionNumber = do
5658installCabal :: Action ()
5759installCabal = do
5860 -- 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
6465
6566 -- install `cabal-install` if not already installed
6667 unless cabalExeOk $ execStackShake_ [" install" , " cabal-install" ]
6768
6869-- | check `stack` has the required version
6970checkCabal :: Action ()
7071checkCabal = do
71- cabalVersion <- trimmedStdout <$> execCabal [ " --numeric-version " ]
72+ cabalVersion <- getCabalVersion
7273 unless (checkVersion requiredCabalVersion cabalVersion) $ do
7374 printInStars $ cabalInstallIsOldFailMsg cabalVersion
7475 error $ stackExeIsOldFailMsg cabalVersion
You can’t perform that action at this time.
0 commit comments