From b9e8666415a9c0d6298c137a4eab9fe4573cbe7d Mon Sep 17 00:00:00 2001 From: Mike Pilgrem Date: Sun, 6 Oct 2024 17:00:00 +0100 Subject: [PATCH] Avoid partial last in autogen Paths_.hs --- Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs index 25c924720ec..780f0157135 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs @@ -69,7 +69,7 @@ render z_root = execWriter $ do return () tell "\n" tell "import qualified Control.Exception as Exception\n" - tell "import qualified Data.List as List\n" + tell "import qualified Data.List.NonEmpty as NE\n" tell "import Data.Version (Version(..))\n" tell "import System.Environment (getEnv)\n" tell "import Prelude\n" @@ -306,9 +306,9 @@ render z_root = execWriter $ do tell "joinFileName \"\" fname = fname\n" tell "joinFileName \".\" fname = fname\n" tell "joinFileName dir \"\" = dir\n" - tell "joinFileName dir fname\n" - tell " | isPathSeparator (List.last dir) = dir ++ fname\n" - tell " | otherwise = dir ++ pathSeparator : fname\n" + tell "joinFileName dir@(c:cs) fname\n" + tell " | isPathSeparator (NE.last (c NE.:| cs)) = dir ++ fname\n" + tell " | otherwise = dir ++ pathSeparator : fname\n" tell "\n" tell "pathSeparator :: Char\n" if (zIsWindows z_root)