| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Dojang.Types.Context
Synopsis
- data CandidateRoute = CandidateRoute {}
- data MonadFileSystem m => Context (m :: Type -> Type) = Context {}
- data FileCorrespondence = FileCorrespondence {}
- data FileDeltaKind
- data FileEntry = FileEntry {}
- data FileStat
- data IgnoredFile = IgnoredFile {}
- data RouteMatch
- data RouteState
- data UnregisteredFile = UnregisteredFile {
- filePath :: OsPath
- candidateRoutes :: [RouteResult]
- calculateSpecificity :: OsPath -> RouteResult -> Int
- filterBySpecificity :: OsPath -> [RouteResult] -> [RouteResult]
- findCandidateRoutesFor :: MonadFileSystem m => Context m -> OsPath -> m [RouteResult]
- findMatchingRoutes :: MonadFileSystem m => Context m -> OsPath -> m (RouteMatch, [RouteMapWarning])
- getIgnoredFiles :: (HasCallStack, MonadFileSystem m) => Context m -> m [IgnoredFile]
- getRouteState :: (HasCallStack, MonadFileSystem m, MonadIO m) => Context m -> OsPath -> m (RouteState, [RouteMapWarning])
- getUnregisteredFiles :: (HasCallStack, MonadFileSystem m) => Context m -> m [UnregisteredFile]
- listFiles :: MonadFileSystem m => OsPath -> [FilePattern] -> m [FileEntry]
- makeCorrespond :: (HasCallStack, MonadFileSystem m) => Context m -> m ([FileCorrespondence], [RouteMapWarning])
- makeCorrespondBetweenThreeDirs :: (HasCallStack, MonadFileSystem m) => OsPath -> OsPath -> OsPath -> [FilePattern] -> m [FileCorrespondence]
- makeCorrespondBetweenThreeFiles :: (HasCallStack, MonadFileSystem m) => OsPath -> OsPath -> OsPath -> m FileCorrespondence
- makeCorrespondBetweenTwoDirs :: (HasCallStack, MonadFileSystem m) => OsPath -> OsPath -> [FilePattern] -> m (Map OsPath (FileEntry, FileEntry))
- makeCorrespondWithDestination :: MonadFileSystem m => Context m -> OsPath -> m (Maybe FileCorrespondence, [RouteMapWarning])
- routePaths :: MonadFileSystem m => Context m -> m ([RouteResult], [RouteMapWarning])
Documentation
data CandidateRoute Source #
A candidate route with computed metadata for disambiguation.
Constructors
| CandidateRoute | |
Fields
| |
Instances
| Show CandidateRoute Source # | |
Defined in Dojang.Types.Context Methods showsPrec :: Int -> CandidateRoute -> ShowS # show :: CandidateRoute -> String # showList :: [CandidateRoute] -> ShowS # | |
| Eq CandidateRoute Source # | |
Defined in Dojang.Types.Context Methods (==) :: CandidateRoute -> CandidateRoute -> Bool # (/=) :: CandidateRoute -> CandidateRoute -> Bool # | |
data MonadFileSystem m => Context (m :: Type -> Type) Source #
The context in which repository operations are performed.
Constructors
| Context | |
Fields
| |
data FileCorrespondence Source #
A correspondence between a source file, an intermediate file, and a destination file.
Constructors
| FileCorrespondence | |
Fields
| |
Instances
| Show FileCorrespondence Source # | |
Defined in Dojang.Types.Context Methods showsPrec :: Int -> FileCorrespondence -> ShowS # show :: FileCorrespondence -> String # showList :: [FileCorrespondence] -> ShowS # | |
| Eq FileCorrespondence Source # | |
Defined in Dojang.Types.Context Methods (==) :: FileCorrespondence -> FileCorrespondence -> Bool # (/=) :: FileCorrespondence -> FileCorrespondence -> Bool # | |
| Ord FileCorrespondence Source # | |
Defined in Dojang.Types.Context Methods compare :: FileCorrespondence -> FileCorrespondence -> Ordering # (<) :: FileCorrespondence -> FileCorrespondence -> Bool # (<=) :: FileCorrespondence -> FileCorrespondence -> Bool # (>) :: FileCorrespondence -> FileCorrespondence -> Bool # (>=) :: FileCorrespondence -> FileCorrespondence -> Bool # max :: FileCorrespondence -> FileCorrespondence -> FileCorrespondence # min :: FileCorrespondence -> FileCorrespondence -> FileCorrespondence # | |
data FileDeltaKind Source #
The kind of change that was made to a file.
Instances
| Show FileDeltaKind Source # | |
Defined in Dojang.Types.Context Methods showsPrec :: Int -> FileDeltaKind -> ShowS # show :: FileDeltaKind -> String # showList :: [FileDeltaKind] -> ShowS # | |
| Eq FileDeltaKind Source # | |
Defined in Dojang.Types.Context Methods (==) :: FileDeltaKind -> FileDeltaKind -> Bool # (/=) :: FileDeltaKind -> FileDeltaKind -> Bool # | |
| Ord FileDeltaKind Source # | |
Defined in Dojang.Types.Context Methods compare :: FileDeltaKind -> FileDeltaKind -> Ordering # (<) :: FileDeltaKind -> FileDeltaKind -> Bool # (<=) :: FileDeltaKind -> FileDeltaKind -> Bool # (>) :: FileDeltaKind -> FileDeltaKind -> Bool # (>=) :: FileDeltaKind -> FileDeltaKind -> Bool # max :: FileDeltaKind -> FileDeltaKind -> FileDeltaKind # min :: FileDeltaKind -> FileDeltaKind -> FileDeltaKind # | |
A file/directory in the repository or the destination directory.
Constructors
| FileEntry | |
Instances
| Show FileEntry Source # | |
| Eq FileEntry Source # | |
| Ord FileEntry Source # | |
The small stat of a file.
Constructors
| Missing | The file is missing. |
| Directory | The file is a directory. |
| File Integer | The file is a regular file, and this is its size in bytes. |
| Symlink OsPath | The file is a symlink, and this is the path to the symlink target. |
data IgnoredFile Source #
Represents a file that is ignored by a route's ignore patterns.
Constructors
| IgnoredFile | |
Fields
| |
Instances
| Show IgnoredFile Source # | |
Defined in Dojang.Types.Context Methods showsPrec :: Int -> IgnoredFile -> ShowS # show :: IgnoredFile -> String # showList :: [IgnoredFile] -> ShowS # | |
| Eq IgnoredFile Source # | |
Defined in Dojang.Types.Context | |
data RouteMatch Source #
Result of finding routes for a destination path.
Constructors
| NoMatch | No matching routes found. |
| SingleMatch RouteResult | A single unambiguous route was found. |
| AmbiguousMatch (NonEmpty CandidateRoute) | Multiple routes match with the same specificity. |
Instances
| Show RouteMatch Source # | |
Defined in Dojang.Types.Context Methods showsPrec :: Int -> RouteMatch -> ShowS # show :: RouteMatch -> String # showList :: [RouteMatch] -> ShowS # | |
| Eq RouteMatch Source # | |
Defined in Dojang.Types.Context | |
data RouteState Source #
Represents the route state of a (potential) destination file in the repository.
Constructors
| Routed OsPath | The file is routed. The |
| Ignored OsPath FilePattern | The file is routed but ignored. The |
| NotRouted | The file is not routed at all. |
Instances
| Show RouteState Source # | |
Defined in Dojang.Types.Context Methods showsPrec :: Int -> RouteState -> ShowS # show :: RouteState -> String # showList :: [RouteState] -> ShowS # | |
| Eq RouteState Source # | |
Defined in Dojang.Types.Context | |
| Ord RouteState Source # | |
Defined in Dojang.Types.Context Methods compare :: RouteState -> RouteState -> Ordering # (<) :: RouteState -> RouteState -> Bool # (<=) :: RouteState -> RouteState -> Bool # (>) :: RouteState -> RouteState -> Bool # (>=) :: RouteState -> RouteState -> Bool # max :: RouteState -> RouteState -> RouteState # min :: RouteState -> RouteState -> RouteState # | |
data UnregisteredFile Source #
Represents a file that is not registered in any route.
Constructors
| UnregisteredFile | |
Fields
| |
Instances
| Show UnregisteredFile Source # | |
Defined in Dojang.Types.Context Methods showsPrec :: Int -> UnregisteredFile -> ShowS # show :: UnregisteredFile -> String # showList :: [UnregisteredFile] -> ShowS # | |
| Eq UnregisteredFile Source # | |
Defined in Dojang.Types.Context Methods (==) :: UnregisteredFile -> UnregisteredFile -> Bool # (/=) :: UnregisteredFile -> UnregisteredFile -> Bool # | |
Arguments
| :: OsPath | The target path. |
| -> RouteResult | The route result. |
| -> Int | The specificity (number of path components from route destination to target). |
Calculate the specificity of a route relative to a target path. Returns the number of path components between the route's destination and the target path. Lower values indicate more specific routes.
Examples
>>>calculateSpecificity "/foo/bar/baz" route -- route.destinationPath = "/foo"2 -- bar/baz
>>>calculateSpecificity "/foo" route -- route.destinationPath = "/foo"0 -- exact match
Arguments
| :: OsPath | The target path. |
| -> [RouteResult] | The list of routes to filter. |
| -> [RouteResult] | The routes with the lowest specificity. |
Filter routes by specificity, keeping only those with the lowest (most specific) specificity value.
findCandidateRoutesFor Source #
Arguments
| :: MonadFileSystem m | |
| => Context m | The context in which to perform the operation. |
| -> OsPath | The path to the unregistered file. |
| -> m [RouteResult] | The list of candidate routes. |
Finds candidate routes for an unregistered file. Returns routes whose destination path is a prefix of the file path.
Arguments
| :: MonadFileSystem m | |
| => Context m | The context in which to perform route matching. |
| -> OsPath | The target path. |
| -> m (RouteMatch, [RouteMapWarning]) | The route match result, along with any warnings that were generated. |
Find matching routes for a destination path.
Returns a RouteMatch indicating whether no routes, a single route,
or multiple ambiguous routes match.
Arguments
| :: (HasCallStack, MonadFileSystem m) | |
| => Context m | The context in which to perform the operation. |
| -> m [IgnoredFile] | The list of ignored files. |
Gets a list of files that are ignored by the repository's ignore patterns. This function scans all directory routes for files that would be excluded by their ignore patterns.
Arguments
| :: (HasCallStack, MonadFileSystem m, MonadIO m) | |
| => Context m | The context in which to perform path routing. |
| -> OsPath | The path (which is a potential destination) to get the route state of. |
| -> m (RouteState, [RouteMapWarning]) | The route state of the path, along with any warnings that were generated. |
Gets the route state of the given path (which is a potential destination).
Arguments
| :: (HasCallStack, MonadFileSystem m) | |
| => Context m | The context in which to perform the operation. |
| -> m [UnregisteredFile] | The list of unregistered files. |
Gets a list of files in destination directories that are not registered in any route. These are files that exist in destination directories but are not part of the repository.
Arguments
| :: MonadFileSystem m | |
| => OsPath | The path to the directory to list entries in. |
| -> [FilePattern] | The file patterns to ignore. If a directory matches one of these patterns, then its contents will not be listed either. |
| -> m [FileEntry] | The list of |
Lists all FilEntry values in the given directory. Throws an IOError if
the directory cannot be read.
Arguments
| :: (HasCallStack, MonadFileSystem m) | |
| => Context m | The context in which to perform file correspondence. |
| -> m ([FileCorrespondence], [RouteMapWarning]) | The file correspondences, along with a list of warnings that occurred
during path routing (if any). The file paths in the returned
|
Creates a list of file correspondences between the source files, the
intermediate files, and the destination files. Throws an IOError if any of
the files cannot be read.
makeCorrespondBetweenThreeDirs :: (HasCallStack, MonadFileSystem m) => OsPath -> OsPath -> OsPath -> [FilePattern] -> m [FileCorrespondence] Source #
makeCorrespondBetweenThreeFiles :: (HasCallStack, MonadFileSystem m) => OsPath -> OsPath -> OsPath -> m FileCorrespondence Source #
makeCorrespondBetweenTwoDirs :: (HasCallStack, MonadFileSystem m) => OsPath -> OsPath -> [FilePattern] -> m (Map OsPath (FileEntry, FileEntry)) Source #
makeCorrespondWithDestination Source #
Arguments
| :: MonadFileSystem m | |
| => Context m | The context in which to perform file correspondence. |
| -> OsPath | The path to the destination file. |
| -> m (Maybe FileCorrespondence, [RouteMapWarning]) | The file correspondence, along with a list of warnings that occurred
during path routing (if any). The file paths in the returned
|
Creates a FileCorrespondence from a single destination file.
Arguments
| :: MonadFileSystem m | |
| => Context m | The context in which to perform path routing. |
| -> m ([RouteResult], [RouteMapWarning]) | The expanded paths, along with any warnings that were generated. |
Route the paths in the repository. This will return a list of expanded paths, along with any warnings that were generated. Null routes will be ignored.