summaryrefslogtreecommitdiff
path: root/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
diff options
context:
space:
mode:
Diffstat (limited to 'hadrian/src/Hadrian/Haskell/Cabal/Parse.hs')
-rw-r--r--hadrian/src/Hadrian/Haskell/Cabal/Parse.hs14
1 files changed, 2 insertions, 12 deletions
diff --git a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
index 776edb15e7..49352c6823 100644
--- a/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
+++ b/hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
@@ -38,9 +38,7 @@ import qualified Distribution.Simple.PackageIndex as C
import qualified Distribution.Text as C
import qualified Distribution.Types.LocalBuildInfo as C
import qualified Distribution.Types.MungedPackageId as C
-#if MIN_VERSION_Cabal(3,2,0)
import qualified Distribution.Utils.ShortText as C
-#endif
#if !MIN_VERSION_Cabal(3,4,0)
import qualified Distribution.Types.CondTree as C
#endif
@@ -76,8 +74,8 @@ parsePackageData pkg = do
deps = nubOrd sorted \\ [name]
depPkgs = catMaybes $ map findPackageByName deps
return $ PackageData name version
- (shortTextToString (C.synopsis pd))
- (shortTextToString (C.description pd))
+ (C.fromShortText (C.synopsis pd))
+ (C.fromShortText (C.description pd))
depPkgs gpd
where
-- Collect an overapproximation of dependencies by ignoring conditionals
@@ -87,14 +85,6 @@ parsePackageData pkg = do
where
f (C.CondBranch _ t mt) = collectDeps (Just t) ++ collectDeps mt
-#if MIN_VERSION_Cabal(3,2,0)
- shortTextToString :: C.ShortText -> String
- shortTextToString = C.fromShortText
-#else
- shortTextToString :: String -> String
- shortTextToString = id
-#endif
-
-- | Parse the package identifier from a Cabal file.
parseCabalPkgId :: FilePath -> IO String
parseCabalPkgId file = C.display . C.package . C.packageDescription <$> C.readGenericPackageDescription C.silent file