BSD-3-Clause licensed by Matti Niemenmaa
Maintained by Matti Niemenmaa
This version can be pinned in stack with:Glob-0.7.5@sha256:219b9caf1aaf9c2ab69ac75242f6017f0cd804a3370e0d63ac48777888fd909b,1335

Module documentation for 0.7.5

  • System
    • System.FilePath
      • System.FilePath.Glob
        • System.FilePath.Glob.Primitive
This is Glob, a Haskell library for globbing, i.e. pattern matching file paths
akin to the POSIX glob() function. Haddock documentation is included, and can
be built with the 'cabal haddock' command. Basic usage info is repeated below:

Matching pattern (a String) against filepath (a FilePath):

match (compile pattern) filepath

Matching a pattern against all paths in the current working directory:

glob pattern

Matching a pattern against all paths in a given directory (a FilePath):

globDir1 (compile pattern) directorypath

Matching a list of patterns against all paths in a given directory, returning
the matches for each pattern as well as the paths not matched by any of the

globDir (map compile patterns) directorypath


0.7.5, 2014-05-08:
Update dependencies to allow transformers-0.4.

0.7.4, 2014-03-18:
Update dependencies to allow dlist-0.7.

0.7.3, 2013-12-01:
Update dependencies to allow dlist-0.6.

0.7.2, 2012-10-18:
Update dependencies to allow directory-1.2.

0.7.1, 2012-07-03:
Update dependencies to allow transformers-0.3, and generally tighten
them according to the policy.

0.7, 2012-01-03:
Changed function types:
System.FilePath.Glob.glob :: String -> IO [FilePath]
Now takes a String to be compiled instead of an already-compiled

Added a README and more basic usage documentation.

0.6.1, 2011-09-14:
Bug fix: globDir should now ignore the given directory when given an
absolute path on Windows.

Doc fix: noted that globDir doesn't actually fully ignore the given
directory if the Pattern starts with a path separator.

0.6, 2011-09-12:
New functions:
System.FilePath.Glob.glob :: Pattern -> IO [FilePath]

Change: globDir, given a Pattern starting with a path separator, now ignores
the given directory. Thus e.g. globDir (compile "/*") d gives the
contents of "/" regardless of the value of d.

Thanks to Max Bolingbroke for the feature request.

Changed dependency on mtl to transformers.

0.5.1, 2010-11-23:
Update dependencies to allow for mtl 2.0.

0.5, 2009-12-01:
New functions:
System.FilePath.Glob.globDir :: Pattern -> FilePath -> IO [FilePath]

0.4, 2009-01-31:
New functions:
System.FilePath.Glob.commonDirectory :: Pattern -> (FilePath, Pattern)

System.FilePath.Glob.simplify :: Pattern -> Pattern
System.FilePath.Glob.decompile :: Pattern -> String

System.FilePath.Glob.tryCompileWith :: CompOptions -> String -> Either String Pattern
System.FilePath.Glob.compileWith :: CompOptions -> String -> Pattern
System.FilePath.Glob.compDefault :: CompOptions
System.FilePath.Glob.compPosix :: CompOptions

System.FilePath.Glob.matchWith :: MatchOptions -> Pattern -> FilePath -> Bool
System.FilePath.Glob.globDirWith :: MatchOptions -> [Pattern] -> FilePath -> IO ([[FilePath]], [FilePath])
System.FilePath.Glob.matchDefault :: MatchOptions
System.FilePath.Glob.matchPosix :: MatchOptions

System.FilePath.Glob.Primitives.literal :: String -> Pattern
System.FilePath.Glob.Primitives.singleWildcard :: Pattern
System.FilePath.Glob.Primitives.wildcard :: Pattern
System.FilePath.Glob.Primitives.recursiveWildcard :: Pattern
System.FilePath.Glob.Primitives.charRange :: Bool -> [Either Char (Char,Char)] -> Pattern
System.FilePath.Glob.Primitives.numberRange :: Maybe Integer -> Maybe Integer -> Pattern

Removed functions:
System.FilePath.Glob.tryCompile (no longer needed / superceded by tryCompileWith)

New instances:
Monoid Pattern
Read Pattern

Change: ".." can now be matched, by patterns such as ".*".
Change: globDir, given "" as the directory, uses getCurrentDirectory.
Change: globDir now keeps track of the number of path separators, thus
"a//*" will return "a//b" instead of "a/b" as a match result.
Change: if character ranges begin with ! or ^, these characters are now
considered the start of the range: [^-~] is the range ^ through ~,
not the inverse of [-~].

Regression fix: handle directories without read permissions even more

Bug fix: globDir doesn't convert patterns like "a./b" to "ab".
Bug fix: the Show instance used to show "[?]" as the very different "?" (and
a few similar cases).
Bug fix: "//./" wasn't getting optimized properly.
Bug fix: ".//a" matched "/a" and not "a" or "./a".
Bug fix: "f**/a" didn't match "foo/a".
Bug fix: ".**/a" didn't match ".foo/a".
Bug fix: ".**/a" matched "../a".
Bug fixes: globDir and match, in general, handled patterns starting with
".*" or ".**/" quite differently.
Bug fix: globDir never matched "foo/" to the directory "foo".
Bug fix: globDir never matched "foo**/" to the directory "foo".
Bug fix: show (compile "[a!b]") resulted in "[!ab]".

0.3.2, 2008-12-20:
Regression fix: handle directories without read permissions properly.

Convenience for developers: -XTemplateHaskell no longer barfs on

0.3.1, 2008-10-31:
Corrected the Cabal-Version field.

0.3, 2008-10-19:
Further performance improvements to globDir.
Bug fix: handle empty pattern lists correctly in globDir.
Added dependency: Win32, for Windows OSs.

0.2, 2008-10-18:
Performance improvements to globDir, no functionality changes.
Added dependency: dlist.

0.1, 2008-10-17:
Initial release.

System.FilePath.Glob.tryCompile :: String -> Either String Pattern
System.FilePath.Glob.compile :: String -> Pattern
System.FilePath.Glob.match :: Pattern -> FilePath -> Bool
System.FilePath.Glob.globDir :: [Pattern] -> FilePath -> IO ([[FilePath]], [FilePath])

Dependencies: base, containers, directory, filepath, mtl.