aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/CabalHelper/Shared/Common.hs5
-rw-r--r--src/CabalHelper/Shared/Sandbox.hs9
2 files changed, 7 insertions, 7 deletions
diff --git a/src/CabalHelper/Shared/Common.hs b/src/CabalHelper/Shared/Common.hs
index 8e8418b..d60e745 100644
--- a/src/CabalHelper/Shared/Common.hs
+++ b/src/CabalHelper/Shared/Common.hs
@@ -162,3 +162,8 @@ readPackageDescription = P.readGenericPackageDescription
#else
readPackageDescription = P.readPackageDescription
#endif
+
+mightExist :: FilePath -> IO (Maybe FilePath)
+mightExist f = do
+ exists <- doesFileExist f
+ return $ if exists then (Just f) else (Nothing)
diff --git a/src/CabalHelper/Shared/Sandbox.hs b/src/CabalHelper/Shared/Sandbox.hs
index f7b7470..d2172a2 100644
--- a/src/CabalHelper/Shared/Sandbox.hs
+++ b/src/CabalHelper/Shared/Sandbox.hs
@@ -28,11 +28,12 @@ import Data.Maybe
import Data.List
import Data.Version
import System.FilePath
-import System.Directory
import Prelude
import qualified Data.Traversable as T
+import CabalHelper.Shared.Common
+
-- | Get the path to the sandbox package-db in a project
getSandboxPkgDb :: String
-- ^ Cabal build platform, i.e. @buildPlatform@
@@ -68,12 +69,6 @@ extractSandboxDbDir conf = extractValue <$> parse conf
parse = listToMaybe . filter (key `isPrefixOf`) . lines
extractValue = CabalHelper.Shared.Sandbox.dropWhileEnd isSpace . dropWhile isSpace . drop keyLen
-
-mightExist :: FilePath -> IO (Maybe FilePath)
-mightExist f = do
- exists <- doesFileExist f
- return $ if exists then (Just f) else (Nothing)
-
-- dropWhileEnd is not provided prior to base 4.5.0.0.
dropWhileEnd :: (a -> Bool) -> [a] -> [a]
dropWhileEnd p = foldr (\x xs -> if p x && null xs then [] else x : xs) []