From 0d2011d04fd06fc6bb21407d2f412439668b6249 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sat, 15 Dec 2018 23:18:41 +0100 Subject: Sync with Cabal HEAD --- tests/CompileTest.hs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'tests') diff --git a/tests/CompileTest.hs b/tests/CompileTest.hs index b5d9003..3be4dc2 100644 --- a/tests/CompileTest.hs +++ b/tests/CompileTest.hs @@ -17,15 +17,14 @@ import Data.Maybe import Data.Version import Data.Functor import Data.Function -import qualified Distribution.Compat.ReadP as Dist import Distribution.Version (VersionRange, withinRange) -import Distribution.Text import Control.Arrow import Control.Monad import Prelude import CabalHelper.Compiletime.Compat.Environment import CabalHelper.Compiletime.Compat.Version +import CabalHelper.Compiletime.Compat.Parsec import CabalHelper.Compiletime.Cabal import CabalHelper.Compiletime.Compile import CabalHelper.Compiletime.Program.CabalInstall @@ -33,11 +32,6 @@ import CabalHelper.Compiletime.Program.GHC import CabalHelper.Compiletime.Types import CabalHelper.Shared.Common -runReadP'Dist :: Dist.ReadP t t -> String -> t -runReadP'Dist p i = case filter ((=="") . snd) $ Dist.readP_to_S p i of - (a,""):[] -> a - _ -> error $ "Error parsing: " ++ show i - withinRange'CH :: Version -> VersionRange -> Bool withinRange'CH v r = withinRange (fromDataVersion v) r @@ -123,14 +117,14 @@ allCabalVersions ghc_ver = let ] constraint :: VersionRange - constraint = - fromMaybe (snd $ last constraint_table) $ + Just constraint = fmap snd $ find (and . (zipWith (==) `on` versionBranch) ghc_ver . fst) $ constraint_table + constraint_table :: [(Version, VersionRange)] constraint_table = - map (parseVer *** runReadP'Dist parse) $ + map (parseVer *** (absorbParsecFailure "constraint_table" . eitherParsec)) $ -- , ("7.8" , ">= 1.18 && < 2") [ ("7.10" , ">= 1.22.2 && < 2") , ("8.0.1", ">= 1.24 ") -- cgit v1.2.3