summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorBodigrim <andrew.lelechenko@gmail.com>2022-09-28 00:15:53 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-09-28 17:50:28 -0400
commit2f050687e75ffe6fbf140cacd15fd916d2997499 (patch)
treeacd68576f0210c85f69b392cb10a7048ee97d17e /hadrian
parentb0c89dfaf9f8aeda9dd69a9583fd29150099aa27 (diff)
downloadhaskell-2f050687e75ffe6fbf140cacd15fd916d2997499.tar.gz
Avoid Data.List.group; prefer Data.List.NonEmpty.group
This allows to avoid further partiality, e. g., map head . group is replaced by map NE.head . NE.group, and there are less panic calls.
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/src/Rules/Dependencies.hs6
1 files changed, 3 insertions, 3 deletions
diff --git a/hadrian/src/Rules/Dependencies.hs b/hadrian/src/Rules/Dependencies.hs
index 453c45acad..ebdb7b70d8 100644
--- a/hadrian/src/Rules/Dependencies.hs
+++ b/hadrian/src/Rules/Dependencies.hs
@@ -2,6 +2,7 @@ module Rules.Dependencies (buildPackageDependencies) where
import Data.Bifunctor
import Data.Function
+import qualified Data.List.NonEmpty as NE
import Base
import Context
@@ -67,9 +68,8 @@ buildPackageDependencies rs = do
writeFileChanged deps . unlines
. map (\(src, deps) -> unwords $ src : deps)
. map (bimap unifyPath (map unifyPath))
- . map (bimap head concat . unzip)
- . groupBy ((==) `on` fst)
- . sortBy (compare `on` fst)
+ . map (bimap NE.head concat . NE.unzip)
+ . NE.groupAllWith fst
$ parseMakefile mkDeps