aboutsummaryrefslogtreecommitdiff
path: root/Distribution
diff options
context:
space:
mode:
Diffstat (limited to 'Distribution')
-rw-r--r--Distribution/Helper.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Distribution/Helper.hs b/Distribution/Helper.hs
index b06ffe4..1a4bc37 100644
--- a/Distribution/Helper.hs
+++ b/Distribution/Helper.hs
@@ -57,6 +57,7 @@ import Control.Monad.IO.Class
import Control.Monad.State.Strict
import Control.Monad.Reader
import Control.Exception as E
+import Data.Char
import Data.Monoid
import Data.List
import Data.Default
@@ -211,6 +212,10 @@ buildPlatform :: IO String
buildPlatform = do
exe <- findLibexecExe "cabal-helper-wrapper"
dropWhileEnd isSpace <$> readProcess exe ["print-build-platform"] ""
+ where
+ -- 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) []
-- | This exception is thrown by all 'runQuery' functions if the internal
-- wrapper executable cannot be found. You may catch this and present the user