cabal-fmt-0.1.12: Format .cabal files

Safe Haskell | None
Language | Haskell2010

CabalFmt.Glob

Synopsis

- data Glob = Glob FilePath [GlobPiece]
- data GlobPiece
  - = GlobStarStar
  - | GlobPiece (NonEmpty GlobChar)
- data GlobChar
  - = GlobStar
  - | GlobChar Char
- match :: Glob -> FilePath -> Bool
- parseGlob :: String -> Either String Glob

# Documentation

data Glob #

Constructors

Glob FilePath [GlobPiece] |

#### Instances

Instances details

Show Glob # |
Instance details Defined in CabalFmt.Glob Methods showsPrec :: Int -> Glob -> ShowS # show :: Glob -> String # showList :: [Glob] -> ShowS #

data GlobPiece #

Constructors

GlobStarStar |
GlobPiece (NonEmpty GlobChar) |

#### Instances

Instances details

Show GlobPiece # |
Instance details Defined in CabalFmt.Glob Methods showsPrec :: Int -> GlobPiece -> ShowS # show :: GlobPiece -> String # showList :: [GlobPiece] -> ShowS #

data GlobChar #

Constructors

GlobStar |
GlobChar Char |

#### Instances

Instances details

Show GlobChar # |
Instance details Defined in CabalFmt.Glob Methods showsPrec :: Int -> GlobChar -> ShowS # show :: GlobChar -> String # showList :: [GlobChar] -> ShowS #

match :: Glob -> FilePath -> Bool #

Match glob

    >>> let Right g = parseGlob "cbits/**/*.c"

    >>> map (match g) ["foo", "cbits/header.h", "cbits/source.c", "cbits/dir/source.c"]
    [False,False,True,True]

parseGlob :: String -> Either String Glob #