[Git][ghc/ghc][wip/T25693] 2 commits: hadrian: Drop uses of head/tail
Ben Gamari (@bgamari)
gitlab at gitlab.haskell.org
Fri Feb 7 15:29:26 UTC 2025
Ben Gamari pushed to branch wip/T25693 at Glasgow Haskell Compiler / GHC
Commits:
e7fc4a48 by Ben Gamari at 2025-02-07T10:11:38-05:00
hadrian: Drop uses of head/tail
To silence warnings with GHC 9.10
- - - - -
becffc9c by Ben Gamari at 2025-02-07T10:11:53-05:00
hadrian: Disable x-data-list-nonempty-unzip warning
- - - - -
3 changed files:
- hadrian/src/Hadrian/Utilities.hs
- hadrian/src/Oracles/ModuleFiles.hs
- hadrian/src/Rules/Dependencies.hs
Changes:
=====================================
hadrian/src/Hadrian/Utilities.hs
=====================================
@@ -149,7 +149,10 @@ as /c/foo, while it occasionally falls over on paths of the form C:\foo.
--
-- See Note [Absolute paths and MSYS].
(-/-) :: FilePath -> FilePath -> FilePath
-_ -/- b | isAbsolute b && not (isAbsolute $ tail b) = b
+_ -/- b
+ | isAbsolute b
+ , _:b' <- b
+ , not (isAbsolute b') = b
"" -/- b = b
a -/- b
| last a == '/' = a ++ b
@@ -636,7 +639,8 @@ renderLibrary name lib synopsis = renderBox $
-- | ipsum |
-- \----------/
renderBox :: [String] -> String
-renderBox ls = tail $ concatMap ('\n' :) (boxTop : map renderLine ls ++ [boxBot])
+renderBox ls =
+ drop 1 $ concatMap ('\n' :) (boxTop : map renderLine ls ++ [boxBot])
where
-- Minimum total width of the box in characters
minimumBoxWidth = 32
=====================================
hadrian/src/Oracles/ModuleFiles.hs
=====================================
@@ -169,10 +169,12 @@ moduleFilesOracle = void $ do
let pairs = sort $ mainpairs ++ [ (encodeModule d f, f) | (fs, d) <- result, f <- fs ]
multi = [ (m, f1, f2) | (m, f1):(n, f2):_ <- tails pairs, m == n ]
- unless (null multi) $ do
- let (m, f1, f2) = head multi
- error $ "Module " ++ m ++ " has more than one source file: "
- ++ f1 ++ " and " ++ f2 ++ "."
+
+ case multi of
+ [] -> return ()
+ (m, f1, f2) : _ ->
+ fail $ "Module " ++ m ++ " has more than one source file: "
+ ++ f1 ++ " and " ++ f2 ++ "."
return $ lookupAll modules pairs
-- Optimisation: we discard Haskell files here, because they are never used
=====================================
hadrian/src/Rules/Dependencies.hs
=====================================
@@ -1,4 +1,5 @@
{-# OPTIONS_GHC -Wno-deprecations #-}
+{-# OPTIONS_GHC -Wno-x-data-list-nonempty-unzip #-}
module Rules.Dependencies (buildPackageDependencies) where
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f6ccd3530954b9ae98361bd77a12c7a62b18edaa...becffc9cd840215cc94de44c77e60a3378278e58
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/f6ccd3530954b9ae98361bd77a12c7a62b18edaa...becffc9cd840215cc94de44c77e60a3378278e58
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20250207/68733ef9/attachment-0001.html>
More information about the ghc-commits
mailing list