From 8e9c7fa4195df6e0f1c592ab2bb1330a46c21956 Mon Sep 17 00:00:00 2001 From: Lennart Spitzner Date: Sat, 24 Oct 2015 12:21:15 +0200 Subject: [PATCH] Fix backwards-compatibility --- cabal-install/Distribution/Client/Status.hs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/cabal-install/Distribution/Client/Status.hs b/cabal-install/Distribution/Client/Status.hs index 1bf2e8626a8..f8dddc1a33d 100644 --- a/cabal-install/Distribution/Client/Status.hs +++ b/cabal-install/Distribution/Client/Status.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE CPP #-} + ----------------------------------------------------------------------------- -- | -- Module : Distribution.Client.Status @@ -85,6 +87,9 @@ import System.FilePath ( splitFileName , joinPath , takeDirectory ) +#if __GLASGOW_HASKELL__ < 710 +import Data.Functor ( (<$) ) +#endif import Control.Monad ( when , forM , guard @@ -94,8 +99,10 @@ import Data.Version ( showVersion ) import Data.Maybe ( isJust ) -import Data.List ( sortOn - , groupBy +import Data.List ( groupBy + , sortBy + ) +import Data.Ord ( comparing ) import Text.PrettyPrint ( empty , ($$) @@ -106,7 +113,11 @@ import Text.PrettyPrint ( empty , ($+$) , (<+>) ) -import Data.Monoid ( (<>) ) +import Data.Monoid ( (<>) +#if __GLASGOW_HASKELL__ < 710 + , mappend +#endif + ) import Data.List ( inits ) import Data.Foldable ( asum ) @@ -307,7 +318,9 @@ status verbosity globalFlags statusFlags = do installedPackageIndex <- getInstalledPackages verbosity comp dbs conf let pkgs = allPackages installedPackageIndex pkgTuples = [ (root, disp $ sourcePackageId pkg) | pkg <- pkgs, root <- [x | Just x <- [pkgRoot pkg]]] - grouped = groupBy (\a b -> fst a == fst b) $ sortOn fst pkgTuples + grouped = groupBy (\a b -> fst a == fst b) + $ sortBy (comparing fst) + $ pkgTuples groups = [(fst (head x), map snd x) | x <- grouped] let packageDoc ps = if Cabal.fromFlag (statusPackages statusFlags) || Cabal.fromFlag (statusAll statusFlags)