Skip to content

Commit

Permalink
Avoid partial last in autogen Paths_<pkg>.hs
Browse files Browse the repository at this point in the history
  • Loading branch information
mpilgrem committed Oct 6, 2024
1 parent 47139c5 commit b9e8666
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b9e8666

Please sign in to comment.