Glob 0.10.0 → 0.10.1
raw patch · 6 files changed
+49/−16 lines, 6 filesdep ~dlistdep ~transformers-compatPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: dlist, transformers-compat
API changes (from Hackage documentation)
Files
- CHANGELOG.txt +5/−0
- Glob.cabal +10/−6
- System/FilePath/Glob/Base.hs +19/−5
- System/FilePath/Glob/Directory.hs +2/−2
- System/FilePath/Glob/Utils.hs +8/−1
- tests/Tests/Directory.hs +5/−2
CHANGELOG.txt view
@@ -1,3 +1,8 @@+0.10.1, 2020-07-19:+ Updated code and dependencies to support dlist-1.0.++ Cabal-Version minimum bumped to 1.10 as Hackage now rejects older minima.+ 0.10.0, 2018-12-19: Bug fix: "**/" matched hidden directories in some scenarios even when matchDotsImplicitly was set to False.
Glob.cabal view
@@ -1,7 +1,7 @@-Cabal-Version: >= 1.9.2+Cabal-Version: >= 1.10 Name: Glob-Version: 0.10.0+Version: 0.10.1 Homepage: http://iki.fi/matti.niemenmaa/glob/ Synopsis: Globbing library Category: System@@ -28,17 +28,19 @@ Build-Depends: base >= 4 && < 5 , containers < 0.7 , directory < 1.4- , dlist >= 0.4 && < 0.9+ , dlist >= 0.4 && < 1.1 , filepath >= 1.1 && < 1.5 , transformers >= 0.2 && < 0.6 , transformers-compat >= 0.3 && < 0.7 if impl(ghc < 8.0)- Build-Depends: semigroups >= 0.18 && < 0.19+ Build-Depends: semigroups >= 0.18 && < 0.20 if os(windows) Build-Depends: Win32 == 2.* + Default-Language: Haskell98+ Exposed-Modules: System.FilePath.Glob System.FilePath.Glob.Primitive Other-Modules: System.FilePath.Glob.Base@@ -58,7 +60,7 @@ Build-Depends: base >= 4 && < 5 , containers < 0.7 , directory < 1.4- , dlist >= 0.4 && < 0.9+ , dlist >= 0.4 && < 1.1 , filepath >= 1.1 && < 1.5 , transformers >= 0.2 && < 0.6 , transformers-compat >= 0.3 && < 0.7@@ -69,10 +71,12 @@ , test-framework-quickcheck2 >= 0.3 && < 1 if impl(ghc < 8.0)- Build-Depends: semigroups >= 0.18 && < 0.19+ Build-Depends: semigroups >= 0.18 && < 0.20 if os(windows) Build-Depends: Win32 == 2.*++ Default-Language: Haskell98 Other-Modules: System.FilePath.Glob.Base System.FilePath.Glob.Directory
System/FilePath/Glob/Base.hs view
@@ -1,6 +1,7 @@ -- File created: 2008-10-10 13:29:26 {-# LANGUAGE CPP #-}+{-# LANGUAGE PatternGuards #-} module System.FilePath.Glob.Base ( Token(..), Pattern(..)@@ -34,7 +35,11 @@ #if !MIN_VERSION_base(4,8,0) import Data.Monoid (Monoid, mappend, mempty, mconcat) #endif+#if MIN_VERSION_base(4,11,0)+import Data.Semigroup (sconcat, stimes)+#else import Data.Semigroup (Semigroup, (<>), sconcat, stimes)+#endif import Data.String (IsString(fromString)) import System.FilePath ( pathSeparator, extSeparator , isExtSeparator, isPathSeparator@@ -542,10 +547,10 @@ -- Has to be done here: we can't backtrack in go, but some cases might -- result in consecutive Literals being generated. -- E.g. "a[b]".- fin (x:y:xs) | isCharLiteral x && isCharLiteral y =- let (ls,rest) = span isCharLiteral xs+ fin (x:y:xs) | Just x' <- isCharLiteral x, Just y' <- isCharLiteral y =+ let (ls,rest) = spanMaybe isCharLiteral xs in fin $ LongLiteral (length ls + 2)- (foldr (\(Literal a) -> (a:)) [] (x:y:ls))+ (foldr (\a -> (a:)) [] (x':y':ls)) : rest -- concatenate LongLiterals@@ -608,10 +613,19 @@ , (OpenRange Nothing Nothing, \n -> replicate n anyDigit) ] - isCharLiteral (Literal _) = True- isCharLiteral _ = False+ isCharLiteral (Literal x) = Just x+ isCharLiteral _ = Nothing anyDigit = CharRange True [Right ('0', '9')]++-- | Like 'span', but let's use a -> Maybe b predicate+spanMaybe :: (a -> Maybe b) -> [a] -> ([b], [a])+spanMaybe f = go+ where+ go xs@[] = ([], xs)+ go xs@(x : xs') = case f x of+ Nothing -> ([], xs)+ Just y -> let (ys, zs) = go xs' in (y : ys, zs) optimizeCharRange :: Bool -> Token -> Token optimizeCharRange precededBySlash (CharRange b rs) =
System/FilePath/Glob/Directory.hs view
@@ -28,7 +28,7 @@ import System.FilePath.Glob.Utils ( getRecursiveContents , nubOrd , pathParts- , partitionDL+ , partitionDL, tailDL , catchIO ) -- |Options which can be passed to the 'globDirWith' function.@@ -223,7 +223,7 @@ then ( DL.singleton $ DL.head contents ++ replicate n pathSeparator- , DL.tail contents+ , tailDL contents ) else let (matches, nonMatches) = partitionDL fst
System/FilePath/Glob/Utils.hs view
@@ -8,7 +8,7 @@ , dropLeadingZeroes , pathParts , nubOrd- , partitionDL+ , partitionDL, tailDL , getRecursiveContents , catchIO ) where@@ -153,6 +153,13 @@ if p x then (DL.cons x ts, fs) else (ts, DL.cons x fs)++tailDL :: DList a -> DList a+#if MIN_VERSION_dlist(1,0,0)+tailDL = DL.fromList . DL.tail+#else+tailDL = DL.tail+#endif nubOrd :: Ord a => [a] -> [a] nubOrd = go Set.empty
tests/Tests/Directory.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} module Tests.Directory where import Test.Framework@@ -6,7 +7,9 @@ import Test.QuickCheck (Property, (===)) import Test.HUnit.Base hiding (Test) import Data.Function (on)-import Data.Monoid ((<>))+#if !MIN_VERSION_base(4,8,0)+import Data.Monoid (mappend)+#endif import Data.List ((\\), sort) import qualified Data.DList as DList @@ -99,7 +102,7 @@ prop_commonDirectory' str = let pat = compile str (a, b) = commonDirectory pat- in (pat, literal a <> b)+ in (pat, literal a `mappend` b) prop_commonDirectory :: PString -> Property prop_commonDirectory = uncurry (===) . prop_commonDirectory' . unPS