Skip to content

Commit be3f443

Browse files
author
Lennart Spitzner
committed
Fix backwards-compatibility
1 parent 36174a5 commit be3f443

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

cabal-install/Distribution/Client/Status.hs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{-# LANGUAGE CPP #-}
2+
13
-----------------------------------------------------------------------------
24
-- |
35
-- Module : Distribution.Client.Status
@@ -77,14 +79,17 @@ import qualified Distribution.Simple.LocalBuildInfo as LBI
7779

7880
import qualified Paths_cabal_install ( version )
7981

80-
import System.Environment ( getExecutablePath )
82+
import Distribution.Client.Compat.ExecutablePath ( getExecutablePath )
8183
import System.Directory ( doesFileExist )
8284
import System.FilePath ( splitFileName
8385
, combine
8486
, splitPath
8587
, joinPath
8688
, takeDirectory
8789
)
90+
#if !MIN_VERSION_base(4,8,0)
91+
import Data.Functor ( (<$) )
92+
#endif
8893
import Control.Monad ( when
8994
, forM
9095
, guard
@@ -94,8 +99,10 @@ import Data.Version ( showVersion
9499
)
95100
import Data.Maybe ( isJust
96101
)
97-
import Data.List ( sortOn
98-
, groupBy
102+
import Data.List ( groupBy
103+
, sortBy
104+
)
105+
import Data.Ord ( comparing
99106
)
100107
import Text.PrettyPrint ( empty
101108
, ($$)
@@ -106,7 +113,11 @@ import Text.PrettyPrint ( empty
106113
, ($+$)
107114
, (<+>)
108115
)
109-
import Data.Monoid ( (<>) )
116+
import Data.Monoid ( (<>)
117+
#if !MIN_VERSION_base(4,8,0)
118+
, mappend
119+
#endif
120+
)
110121
import Data.List ( inits )
111122
import Data.Foldable ( asum )
112123

@@ -307,7 +318,9 @@ status verbosity globalFlags statusFlags = do
307318
installedPackageIndex <- getInstalledPackages verbosity comp dbs conf
308319
let pkgs = allPackages installedPackageIndex
309320
pkgTuples = [ (root, disp $ sourcePackageId pkg) | pkg <- pkgs, root <- [x | Just x <- [pkgRoot pkg]]]
310-
grouped = groupBy (\a b -> fst a == fst b) $ sortOn fst pkgTuples
321+
grouped = groupBy (\a b -> fst a == fst b)
322+
$ sortBy (comparing fst)
323+
$ pkgTuples
311324
groups = [(fst (head x), map snd x) | x <- grouped]
312325
let packageDoc ps = if Cabal.fromFlag (statusPackages statusFlags)
313326
|| Cabal.fromFlag (statusAll statusFlags)

0 commit comments

Comments
 (0)