[commit: packages/filepath] master: Optimise isPathSeparator (aeaeb4d)

git at git.haskell.org git at git.haskell.org
Thu Mar 19 11:37:32 UTC 2015


Repository : ssh://git@git.haskell.org/filepath

On branch  : master
Link       : http://git.haskell.org/packages/filepath.git/commitdiff/aeaeb4da9044186087971bb14c076bea64e92c1f

>---------------------------------------------------------------

commit aeaeb4da9044186087971bb14c076bea64e92c1f
Author: Neil Mitchell <ndmitchell at gmail.com>
Date:   Mon Nov 10 11:15:23 2014 +0000

    Optimise isPathSeparator


>---------------------------------------------------------------

aeaeb4da9044186087971bb14c076bea64e92c1f
 System/FilePath/Internal.hs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/System/FilePath/Internal.hs b/System/FilePath/Internal.hs
index 07eafb2..0e40fc6 100644
--- a/System/FilePath/Internal.hs
+++ b/System/FilePath/Internal.hs
@@ -151,7 +151,9 @@ pathSeparators = if isWindows then "\\/" else "/"
 --
 -- > isPathSeparator a == (a `elem` pathSeparators)
 isPathSeparator :: Char -> Bool
-isPathSeparator = (`elem` pathSeparators)
+isPathSeparator '/' = True
+isPathSeparator '\\' = isWindows
+isPathSeparator _ = False
 
 
 -- | The character that is used to separate the entries in the $PATH environment variable.



More information about the ghc-commits mailing list