From 2a743bbddd4de41a77af9b83ec4720cd013292cf Mon Sep 17 00:00:00 2001 From: Thomas Miedema Date: Tue, 23 Sep 2014 08:44:02 -0500 Subject: Delete hack when takeDirectory returns "" Summary: Since commits 8fe1f8 and bb6731 in the filepath packages (ticket #2034, closed in 2010), takeDirectory "foo" returns ".", and not "", so this check is no longer needed. Other commits: * Remove trailing whitespace * Update comments for #2278 Test Plan: harbormaster Reviewers: austin Reviewed By: austin Subscribers: simonmar, ezyang, carter Differential Revision: https://phabricator.haskell.org/D213 GHC Trac Issues: #2034 --- compiler/utils/Util.lhs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'compiler/utils/Util.lhs') diff --git a/compiler/utils/Util.lhs b/compiler/utils/Util.lhs index 97bafe6f23..999eb90c33 100644 --- a/compiler/utils/Util.lhs +++ b/compiler/utils/Util.lhs @@ -262,7 +262,7 @@ splitEithers (e : es) = case e of chkAppend :: [a] -> [a] -> [a] -- Checks for the second arguemnt being empty -- Used in situations where that situation is common -chkAppend xs ys +chkAppend xs ys | null ys = xs | otherwise = xs ++ ys \end{code} @@ -589,7 +589,7 @@ dropTail :: Int -> [a] -> [a] dropTail n xs = go (drop n xs) xs where - go (_:ys) (x:xs) = x : go ys xs + go (_:ys) (x:xs) = x : go ys xs go _ _ = [] -- Stop when ys runs out -- It'll always run out before xs does @@ -950,9 +950,7 @@ maybeReadFuzzy str = case reads str of -- Verify that the 'dirname' portion of a FilePath exists. -- doesDirNameExist :: FilePath -> IO Bool -doesDirNameExist fpath = case takeDirectory fpath of - "" -> return True -- XXX Hack - _ -> doesDirectoryExist (takeDirectory fpath) +doesDirNameExist fpath = doesDirectoryExist (takeDirectory fpath) ----------------------------------------------------------------------------- -- Backwards compatibility definition of getModificationTime -- cgit v1.2.1