Fs.FileTest
eff FileTestSourceAn effect used to test file properties (exists, directory, regular file, symbolic link).
Operations
def exists(f: String): Result[IoError, Bool] \ FileTest
SourceReturns true if the given file f exists.
def isDirectory(f: String): Result[IoError, Bool] \ FileTest
SourceReturns true if the given file f is a directory.
def isRegularFile(f: String): Result[IoError, Bool] \ FileTest
SourceReturns true if the given file f is a regular file.
def isSymbolicLink(f: String): Result[IoError, Bool] \ FileTest
SourceReturns true if the given file f is a symbolic link.
Definitions
def handle(f: a -> b \ ef): a -> b \ (ef - FileTest) + IO
SourceHandles the FileTest effect of the given function f.
In other words, re-interprets the FileTest effect using the IO effect.
def runWithFileStat(f: Unit -> a \ ef): a \ (ef - FileTest) + FileStat
SourceHandles the FileTest effect of the given function f using the FileStat effect.
@DefaultHandler def runWithIO(f: Unit -> a \ ef): a \ (ef - FileTest) + IO
SourceRuns the FileTest effect of the given function f.
In other words, re-interprets the FileTest effect using the IO effect.
def withAllowGlob(patterns: Nel[String], f: Unit -> a \ ef): a \ (ef - FileTest) + FileTest
SourceMiddleware that intercepts the FileTest effect, validating that all file paths
match at least one of the given glob patterns. Rejects paths that do not match
with a PermissionDenied error.
def withAllowList(allowedDirs: Nel[String], f: Unit -> a \ ef): a \ (ef - FileTest) + FileTest
SourceMiddleware that intercepts the FileTest effect, validating that all file paths
resolve within one of the given allowedDirs. Rejects paths outside the
allow list with a PermissionDenied error.
def withBaseDir(baseDir: String, f: Unit -> a \ ef): a \ (ef - FileTest) + FileTest
SourceMiddleware that intercepts the FileTest effect, resolving all file paths
relative to the given baseDir using Java's Path.resolve semantics.
Absolute paths are passed through unchanged.
def withChroot(chrootDir: String, f: Unit -> a \ ef): a \ (ef - FileTest) + FileTest
SourceMiddleware that intercepts the FileTest effect, validating that all file paths
resolve within the given chrootDir. Rejects paths that escape the chroot with
a PermissionDenied error.
def withDenyGlob(patterns: Nel[String], f: Unit -> a \ ef): a \ (ef - FileTest) + FileTest
SourceMiddleware that intercepts the FileTest effect, validating that all file paths
do not match any of the given glob patterns. Rejects paths that match a denied
pattern with a PermissionDenied error.
def withDenyList(deniedDirs: Nel[String], f: Unit -> a \ ef): a \ (ef - FileTest) + FileTest
SourceMiddleware that intercepts the FileTest effect, validating that all file paths
do not resolve within any of the given deniedDirs. Rejects paths inside a
denied directory with a PermissionDenied error.
def withFollowLinks(f: Unit -> a \ ef): a \ (ef - FileTest) + FileTest
SourceMiddleware that intercepts the FileTest effect, resolving all file paths
to their real filesystem targets by following symlinks.
- Bool ops (
exists,isDirectory,isRegularFile): resolve path; returnOk(false)for dangling symlinks. isSymbolicLink: passed through unchanged (always checks the link itself).
def withLogging(f: Unit -> a \ ef): a \ (ef - FileTest) + FileTest + Logger
SourceMiddleware that intercepts the FileTest effect, logging each operation
and its result via the Logger effect.
Successful operations are logged at Debug level; errors at Warn.