Safe Haskell | None |
---|
IO.Filesystem
Contents
- module System.FilePath
- module Definitive
- data File
- data DirEntry = DirEntry FilePath File
- getFile :: FilePath -> IO File
- workingDirectory :: IO DirEntry
- data Location
- pathTo :: [progName :: FilePath] => Location -> FilePath
- getConfig :: [progName :: FilePath] => IO File
- newtype FS a = FS {}
- data Filesystem
- file :: String -> Lens' Filesystem File
- modTime :: FilePath -> IO (TimeVal Seconds)
- contents :: Traversal' File (Maybe String, Maybe Bytes)
- children :: Traversal' File (Map String File)
- child :: Traversal' File File
- descendant :: Fold' File File
- subEntry :: Traversal' DirEntry DirEntry
- anyEntry :: Fold' DirEntry DirEntry
- entryName :: Lens' DirEntry String
- entryFile :: Lens' DirEntry File
- named :: (String -> Bool) -> Traversal' DirEntry DirEntry
- withExtension :: String -> Traversal' DirEntry DirEntry
- fileName :: Lens' DirEntry String
- entry :: Lens' DirEntry File
- text :: Traversal' File String
- bytes :: Traversal' File Bytes
Exported modules
module System.FilePath
module Definitive
The File interface
workingDirectory :: IO DirEntrySource
The working directory, as a DirEntry
A useful monad for manipulating the filesystem as a state
The FS monad is a wrapper around the IO monad that provides a MonadState instance for interacting with the filesystem through the Filesystem type.
Thus, you may use lenses to access the representation of files as though they were variables, like so :
runFS $ (file "x.bmp".bytes.serial.from bmp) fs ^>= \r -> file "foo".bytes.serial.from jpg =- r
Instances
data Filesystem Source