Distribution.Simple.FileMonitor.Types

Cabal-3.16.0.0: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Simple.FileMonitor.Types

Contents

- Globs with respect to a root
- File monitoring
  - Utility constructors of `MonitorFilePath`

Description

Types for monitoring files and directories.

Synopsis

- data RootedGlob = RootedGlob FilePathRoot Glob
- data FilePathRoot
  - = FilePathRelative
  - | FilePathRoot FilePath
  - | FilePathHomeDir
- data Glob
- data MonitorFilePath
  - = MonitorFile {
    - monitorKindFile :: !MonitorKindFile
    - monitorKindDir :: !MonitorKindDir
    - monitorPath :: !FilePath
    }
  - | MonitorFileGlob {
    - monitorKindFile :: !MonitorKindFile
    - monitorKindDir :: !MonitorKindDir
    - monitorPathGlob :: !RootedGlob
    }
- data MonitorKindFile
  - = FileExists
  - | FileModTime
  - | FileHashed
  - | FileNotExists
- data MonitorKindDir
  - = DirExists
  - | DirModTime
  - | DirNotExists
- monitorFile :: FilePath -> MonitorFilePath
- monitorFileHashed :: FilePath -> MonitorFilePath
- monitorNonExistentFile :: FilePath -> MonitorFilePath
- monitorFileExistence :: FilePath -> MonitorFilePath
- monitorDirectory :: FilePath -> MonitorFilePath
- monitorNonExistentDirectory :: FilePath -> MonitorFilePath
- monitorDirectoryExistence :: FilePath -> MonitorFilePath
- monitorFileOrDirectory :: FilePath -> MonitorFilePath
- monitorFileGlob :: RootedGlob -> MonitorFilePath
- monitorFileGlobExistence :: RootedGlob -> MonitorFilePath
- monitorFileSearchPath :: [FilePath] -> FilePath -> [MonitorFilePath]
- monitorFileHashedSearchPath :: [FilePath] -> FilePath -> [MonitorFilePath]

# Globs with respect to a root

data RootedGlob Source #

A file path specified by globbing, relative to some root directory.

Constructors

RootedGlob |
Fields FilePathRoot what the glob is relative to Glob the glob

#### Instances

Instances details

Parsec RootedGlob Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods parsec :: CabalParsing m => m RootedGlob Source #
Pretty RootedGlob Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods pretty :: RootedGlob -> Doc Source # prettyVersioned :: CabalSpecVersion -> RootedGlob -> Doc Source #
Structured RootedGlob Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods structure :: Proxy RootedGlob -> Structure Source # structureHash' :: Tagged RootedGlob MD5
Binary RootedGlob Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods put :: RootedGlob -> Put # get :: Get RootedGlob # putList :: [RootedGlob] -> Put #
Eq RootedGlob Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods (==) :: RootedGlob -> RootedGlob -> Bool # (/=) :: RootedGlob -> RootedGlob -> Bool #
Generic RootedGlob Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Associated Types
type Rep RootedGlob |
Instance details Defined in Distribution.Simple.FileMonitor.Types type Rep RootedGlob = D1 ('MetaData "RootedGlob" "Distribution.Simple.FileMonitor.Types" "Cabal-3.16.0.0-558c" 'False) (C1 ('MetaCons "RootedGlob" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePathRoot) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Glob)))
Methods from :: RootedGlob -> Rep RootedGlob x # to :: Rep RootedGlob x -> RootedGlob #
Show RootedGlob Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods showsPrec :: Int -> RootedGlob -> ShowS # show :: RootedGlob -> String # showList :: [RootedGlob] -> ShowS #
type Rep RootedGlob Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types type Rep RootedGlob = D1 ('MetaData "RootedGlob" "Distribution.Simple.FileMonitor.Types" "Cabal-3.16.0.0-558c" 'False) (C1 ('MetaCons "RootedGlob" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePathRoot) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Glob)))

data FilePathRoot Source #

Constructors

FilePathRelative |
FilePathRoot FilePath | e.g. `"/"`, `"c:"` or result of `takeDrive`
FilePathHomeDir |

#### Instances

Instances details

Parsec FilePathRoot Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods parsec :: CabalParsing m => m FilePathRoot Source #
Pretty FilePathRoot Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods pretty :: FilePathRoot -> Doc Source # prettyVersioned :: CabalSpecVersion -> FilePathRoot -> Doc Source #
Structured FilePathRoot Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods structure :: Proxy FilePathRoot -> Structure Source # structureHash' :: Tagged FilePathRoot MD5
Binary FilePathRoot Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods put :: FilePathRoot -> Put # get :: Get FilePathRoot # putList :: [FilePathRoot] -> Put #
Eq FilePathRoot Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods (==) :: FilePathRoot -> FilePathRoot -> Bool # (/=) :: FilePathRoot -> FilePathRoot -> Bool #
Generic FilePathRoot Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Associated Types
type Rep FilePathRoot |
Instance details Defined in Distribution.Simple.FileMonitor.Types type Rep FilePathRoot = D1 ('MetaData "FilePathRoot" "Distribution.Simple.FileMonitor.Types" "Cabal-3.16.0.0-558c" 'False) (C1 ('MetaCons "FilePathRelative" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "FilePathRoot" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath)) :+: C1 ('MetaCons "FilePathHomeDir" 'PrefixI 'False) (U1 :: Type -> Type)))
Methods from :: FilePathRoot -> Rep FilePathRoot x # to :: Rep FilePathRoot x -> FilePathRoot #
Show FilePathRoot Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods showsPrec :: Int -> FilePathRoot -> ShowS # show :: FilePathRoot -> String # showList :: [FilePathRoot] -> ShowS #
type Rep FilePathRoot Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types type Rep FilePathRoot = D1 ('MetaData "FilePathRoot" "Distribution.Simple.FileMonitor.Types" "Cabal-3.16.0.0-558c" 'False) (C1 ('MetaCons "FilePathRelative" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "FilePathRoot" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 FilePath)) :+: C1 ('MetaCons "FilePathHomeDir" 'PrefixI 'False) (U1 :: Type -> Type)))

data Glob Source #

A filepath specified by globbing.

#### Instances

Instances details

Parsec Glob Source # |
Instance details Defined in Distribution.Simple.Glob.Internal Methods parsec :: CabalParsing m => m Glob Source #
Pretty Glob Source # |
Instance details Defined in Distribution.Simple.Glob.Internal Methods pretty :: Glob -> Doc Source # prettyVersioned :: CabalSpecVersion -> Glob -> Doc Source #
Structured Glob Source # |
Instance details Defined in Distribution.Simple.Glob.Internal Methods structure :: Proxy Glob -> Structure Source # structureHash' :: Tagged Glob MD5
Binary Glob Source # |
Instance details Defined in Distribution.Simple.Glob.Internal Methods put :: Glob -> Put # get :: Get Glob # putList :: [Glob] -> Put #
Eq Glob Source # |
Instance details Defined in Distribution.Simple.Glob.Internal Methods (==) :: Glob -> Glob -> Bool # (/=) :: Glob -> Glob -> Bool #
Generic Glob Source # |
Instance details Defined in Distribution.Simple.Glob.Internal Associated Types
type Rep Glob |
Instance details Defined in Distribution.Simple.Glob.Internal type Rep Glob = D1 ('MetaData "Glob" "Distribution.Simple.Glob.Internal" "Cabal-3.16.0.0-558c" 'False) ((C1 ('MetaCons "GlobDir" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 GlobPieces) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Glob)) :+: C1 ('MetaCons "GlobDirRecursive" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 GlobPieces))) :+: (C1 ('MetaCons "GlobFile" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 GlobPieces)) :+: C1 ('MetaCons "GlobDirTrailing" 'PrefixI 'False) (U1 :: Type -> Type)))
Methods from :: Glob -> Rep Glob x # to :: Rep Glob x -> Glob #
Show Glob Source # |
Instance details Defined in Distribution.Simple.Glob.Internal Methods showsPrec :: Int -> Glob -> ShowS # show :: Glob -> String # showList :: [Glob] -> ShowS #
type Rep Glob Source # |
Instance details Defined in Distribution.Simple.Glob.Internal type Rep Glob = D1 ('MetaData "Glob" "Distribution.Simple.Glob.Internal" "Cabal-3.16.0.0-558c" 'False) ((C1 ('MetaCons "GlobDir" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 GlobPieces) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Glob)) :+: C1 ('MetaCons "GlobDirRecursive" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 GlobPieces))) :+: (C1 ('MetaCons "GlobFile" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 GlobPieces)) :+: C1 ('MetaCons "GlobDirTrailing" 'PrefixI 'False) (U1 :: Type -> Type)))

# File monitoring

data MonitorFilePath Source #

A description of a file (or set of files) to monitor for changes.

Where file paths are relative they are relative to a common directory (e.g. project root), not necessarily the process current directory.

Constructors

MonitorFile |
Fields monitorKindFile :: !MonitorKindFile monitorKindDir :: !MonitorKindDir monitorPath :: !FilePath
MonitorFileGlob |
Fields monitorKindFile :: !MonitorKindFile monitorKindDir :: !MonitorKindDir monitorPathGlob :: !RootedGlob

#### Instances

Instances details

Structured MonitorFilePath Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods structure :: Proxy MonitorFilePath -> Structure Source # structureHash' :: Tagged MonitorFilePath MD5
Binary MonitorFilePath Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods put :: MonitorFilePath -> Put # get :: Get MonitorFilePath # putList :: [MonitorFilePath] -> Put #
Eq MonitorFilePath Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods (==) :: MonitorFilePath -> MonitorFilePath -> Bool # (/=) :: MonitorFilePath -> MonitorFilePath -> Bool #
Generic MonitorFilePath Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Associated Types
type Rep MonitorFilePath |
Instance details Defined in Distribution.Simple.FileMonitor.Types type Rep MonitorFilePath = D1 ('MetaData "MonitorFilePath" "Distribution.Simple.FileMonitor.Types" "Cabal-3.16.0.0-558c" 'False) (C1 ('MetaCons "MonitorFile" 'PrefixI 'True) (S1 ('MetaSel ('Just "monitorKindFile") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MonitorKindFile) :*: (S1 ('MetaSel ('Just "monitorKindDir") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MonitorKindDir) :*: S1 ('MetaSel ('Just "monitorPath") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FilePath))) :+: C1 ('MetaCons "MonitorFileGlob" 'PrefixI 'True) (S1 ('MetaSel ('Just "monitorKindFile") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MonitorKindFile) :*: (S1 ('MetaSel ('Just "monitorKindDir") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MonitorKindDir) :*: S1 ('MetaSel ('Just "monitorPathGlob") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RootedGlob))))
Methods from :: MonitorFilePath -> Rep MonitorFilePath x # to :: Rep MonitorFilePath x -> MonitorFilePath #
Show MonitorFilePath Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods showsPrec :: Int -> MonitorFilePath -> ShowS # show :: MonitorFilePath -> String # showList :: [MonitorFilePath] -> ShowS #
type Rep MonitorFilePath Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types type Rep MonitorFilePath = D1 ('MetaData "MonitorFilePath" "Distribution.Simple.FileMonitor.Types" "Cabal-3.16.0.0-558c" 'False) (C1 ('MetaCons "MonitorFile" 'PrefixI 'True) (S1 ('MetaSel ('Just "monitorKindFile") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MonitorKindFile) :*: (S1 ('MetaSel ('Just "monitorKindDir") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MonitorKindDir) :*: S1 ('MetaSel ('Just "monitorPath") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 FilePath))) :+: C1 ('MetaCons "MonitorFileGlob" 'PrefixI 'True) (S1 ('MetaSel ('Just "monitorKindFile") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MonitorKindFile) :*: (S1 ('MetaSel ('Just "monitorKindDir") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 MonitorKindDir) :*: S1 ('MetaSel ('Just "monitorPathGlob") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RootedGlob))))

data MonitorKindFile Source #

Constructors

FileExists |
FileModTime |
FileHashed |
FileNotExists |

#### Instances

Instances details

Structured MonitorKindFile Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods structure :: Proxy MonitorKindFile -> Structure Source # structureHash' :: Tagged MonitorKindFile MD5
Binary MonitorKindFile Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods put :: MonitorKindFile -> Put # get :: Get MonitorKindFile # putList :: [MonitorKindFile] -> Put #
Eq MonitorKindFile Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods (==) :: MonitorKindFile -> MonitorKindFile -> Bool # (/=) :: MonitorKindFile -> MonitorKindFile -> Bool #
Generic MonitorKindFile Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Associated Types
type Rep MonitorKindFile |
Instance details Defined in Distribution.Simple.FileMonitor.Types type Rep MonitorKindFile = D1 ('MetaData "MonitorKindFile" "Distribution.Simple.FileMonitor.Types" "Cabal-3.16.0.0-558c" 'False) ((C1 ('MetaCons "FileExists" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FileModTime" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "FileHashed" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FileNotExists" 'PrefixI 'False) (U1 :: Type -> Type)))
Methods from :: MonitorKindFile -> Rep MonitorKindFile x # to :: Rep MonitorKindFile x -> MonitorKindFile #
Show MonitorKindFile Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods showsPrec :: Int -> MonitorKindFile -> ShowS # show :: MonitorKindFile -> String # showList :: [MonitorKindFile] -> ShowS #
type Rep MonitorKindFile Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types type Rep MonitorKindFile = D1 ('MetaData "MonitorKindFile" "Distribution.Simple.FileMonitor.Types" "Cabal-3.16.0.0-558c" 'False) ((C1 ('MetaCons "FileExists" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FileModTime" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "FileHashed" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "FileNotExists" 'PrefixI 'False) (U1 :: Type -> Type)))

data MonitorKindDir Source #

Constructors

DirExists |
DirModTime |
DirNotExists |

#### Instances

Instances details

Structured MonitorKindDir Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods structure :: Proxy MonitorKindDir -> Structure Source # structureHash' :: Tagged MonitorKindDir MD5
Binary MonitorKindDir Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods put :: MonitorKindDir -> Put # get :: Get MonitorKindDir # putList :: [MonitorKindDir] -> Put #
Eq MonitorKindDir Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods (==) :: MonitorKindDir -> MonitorKindDir -> Bool # (/=) :: MonitorKindDir -> MonitorKindDir -> Bool #
Generic MonitorKindDir Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Associated Types
type Rep MonitorKindDir |
Instance details Defined in Distribution.Simple.FileMonitor.Types type Rep MonitorKindDir = D1 ('MetaData "MonitorKindDir" "Distribution.Simple.FileMonitor.Types" "Cabal-3.16.0.0-558c" 'False) (C1 ('MetaCons "DirExists" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "DirModTime" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DirNotExists" 'PrefixI 'False) (U1 :: Type -> Type)))
Methods from :: MonitorKindDir -> Rep MonitorKindDir x # to :: Rep MonitorKindDir x -> MonitorKindDir #
Show MonitorKindDir Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types Methods showsPrec :: Int -> MonitorKindDir -> ShowS # show :: MonitorKindDir -> String # showList :: [MonitorKindDir] -> ShowS #
type Rep MonitorKindDir Source # |
Instance details Defined in Distribution.Simple.FileMonitor.Types type Rep MonitorKindDir = D1 ('MetaData "MonitorKindDir" "Distribution.Simple.FileMonitor.Types" "Cabal-3.16.0.0-558c" 'False) (C1 ('MetaCons "DirExists" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "DirModTime" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "DirNotExists" 'PrefixI 'False) (U1 :: Type -> Type)))

## Utility constructors of `MonitorFilePath`

monitorFile :: FilePath -> MonitorFilePath Source #

Monitor a single file for changes, based on its modification time. The monitored file is considered to have changed if it no longer exists or if its modification time has changed.

monitorFileHashed :: FilePath -> MonitorFilePath Source #

Monitor a single file for changes, based on its modification time and content hash. The monitored file is considered to have changed if it no longer exists or if its modification time and content hash have changed.

monitorNonExistentFile :: FilePath -> MonitorFilePath Source #

Monitor a single non-existent file for changes. The monitored file is considered to have changed if it exists.

monitorFileExistence :: FilePath -> MonitorFilePath Source #

Monitor a single file for existence only. The monitored file is considered to have changed if it no longer exists.

monitorDirectory :: FilePath -> MonitorFilePath Source #

Monitor a single directory for changes, based on its modification time. The monitored directory is considered to have changed if it no longer exists or if its modification time has changed.

monitorNonExistentDirectory :: FilePath -> MonitorFilePath Source #

Monitor a single non-existent directory for changes. The monitored directory is considered to have changed if it exists.

monitorDirectoryExistence :: FilePath -> MonitorFilePath Source #

Monitor a single directory for existence. The monitored directory is considered to have changed only if it no longer exists.

monitorFileOrDirectory :: FilePath -> MonitorFilePath Source #

Monitor a single file or directory for changes, based on its modification time. The monitored file is considered to have changed if it no longer exists or if its modification time has changed.

monitorFileGlob :: RootedGlob -> MonitorFilePath Source #

Monitor a set of files (or directories) identified by a file glob. The monitored glob is considered to have changed if the set of files matching the glob changes (i.e. creations or deletions), or for files if the modification time and content hash of any matching file has changed.

monitorFileGlobExistence :: RootedGlob -> MonitorFilePath Source #

Monitor a set of files (or directories) identified by a file glob for existence only. The monitored glob is considered to have changed if the set of files matching the glob changes (i.e. creations or deletions).

monitorFileSearchPath :: [FilePath] -> FilePath -> [MonitorFilePath] Source #

Creates a list of files to monitor when you search for a file which unsuccessfully looked in `notFoundAtPaths` before finding it at `foundAtPath`.

monitorFileHashedSearchPath :: [FilePath] -> FilePath -> [MonitorFilePath] Source #

Similar to `monitorFileSearchPath`, but also instructs us to monitor the hash of the found file.