-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Declare, construct and verify directory layout -- -- Language to express directory layouts @package directory-layout @version 0.4.0.0 -- | Wrappers around exception throwing functions and related routines module System.Directory.Layout.Errored -- | Information about cought exceptions in various routines data LayoutException -- | createDirectory exceptions CD :: IOErrorType -> FilePath -> LayoutException -- | createFile eceptions CF :: IOErrorType -> FilePath -> LayoutException -- | fileExists eceptions FE :: IOErrorType -> FilePath -> LayoutException -- | directoryExists eceptions DE :: IOErrorType -> FilePath -> LayoutException -- | readFile eceptions RF :: IOErrorType -> FilePath -> Text -> LayoutException -- | IO-exceptions-free createDirectory createDirectory :: MonadIO m => FilePath -> m (Either LayoutException ()) -- | IO-exceptions-free writeFile createFile :: MonadIO m => FilePath -> Maybe Text -> m (Either LayoutException ()) -- | doesFileExist that returns Either instead of Bool fileExists :: MonadIO m => FilePath -> m (Either LayoutException ()) -- | doesDirectoryExist that returns Either instead of -- Bool directoryExists :: MonadIO m => FilePath -> m (Either LayoutException ()) -- | IO-exceptions-free readFile readFile :: MonadIO m => FilePath -> Text -> m (Either LayoutException ()) -- | Log failures anyfail :: MonadWriter [w] m => m (Either w a) -> m () -- | Make paths in LayoutException relative to given FilePath relative :: FilePath -> LayoutException -> LayoutException instance Show LayoutException instance Eq LayoutException -- | Free monad based directory layouts module System.Directory.Layout.Internal -- | A representation of directory layouts -- -- Invariants: -- --
-- % tree -- . ---- -- and you've written simple layout: -- --
-- layout = do -- directory "baz" $ -- file_ "twey" -- directory "foo" $ do -- directory "bar" $ do -- file_ "quuz" -- file_ "tatata" -- file_ "quux" ---- -- then running it should result in this directory tree: -- --
-- % tree -- . -- ├── baz -- │ └── twey -- └── foo -- ├── bar -- │ ├── quuz -- │ └── tatata -- └── quux --make :: Layout -> FilePath -> IO [LayoutException] -- | Check directory layout agrees with specified one -- -- For example, suppose there is a tree: -- --
-- % tree -- . -- ├── baz -- │ └── twey -- └── foo -- ├── bar -- │ ├── quuz -- │ └── tatata -- └── quux ---- -- then you can write: -- --
-- layout = do -- directory "baz" $ -- file_ "twey" -- directory "foo" $ do -- directory "bar" $ do -- file_ "quuz" -- file_ "tatata" -- file_ "quux" ---- -- and running check layout "." should result in [] check :: Layout -> FilePath -> IO [LayoutException] -- | Control.Lens based extractors for Layout module System.Directory.Layout.Lens -- | Target Text from the current Layout top (if possible) -- --
-- >>> layout ^? text -- Nothing -- -- >>> layout ^? file "foo" . text -- Just "not empty" -- -- >>> layout ^? directory "bar" . file "quux" . text -- Just "something" --text :: Prism' Layout Text -- | Target FilePath from the current Layout top (if -- possible) -- --
-- >>> layout ^? name -- Just "foo" -- -- >>> layout ^? directory "bar" . name -- Just "baz" -- -- >>> layout ^? directory "quux" . name -- Nothing -- -- >>> layout & name .~ "boo" -- F "boo" (T "not empty" ()) (D "bar" (F "baz" (E ()) (F "quux" (T "something" ()) (E ()))) (F "swaks" (E ()) (E ()))) --name :: Traversal' Layout FilePath -- | Target all Filpaths from current Layout layer -- --
-- >>> layout ^? names -- Just "foo" -- -- >>> layout ^.. names -- ["foo","bar","swaks"] -- -- >>> layout ^.. directory "bar" . names -- ["baz","quux"] -- -- >>> layout & directory "bar" . names %~ reverse -- F "foo" (T "not empty" ()) (D "bar" (F "zab" (E ()) (F "xuuq" (T "something" ()) (E ()))) (F "swaks" (E ()) (E ()))) --names :: Traversal' Layout FilePath -- | Target next Node -- --
-- >>> layout ^? name -- Just "foo" -- -- >>> layout ^? next . name -- Just "bar" -- -- >>> layout ^? next . next . name -- Just "swaks" -- -- >>> layout ^? next . next . next . name -- Nothing --next :: Traversal' Layout Layout -- | Target Layout under the current Layout top if it happens -- to be a file -- --
-- >>> layout ^? file "biz" -- Nothing -- -- >>> layout ^? file "swaks" -- Just (E ()) -- -- >>> layout ^? directory "bar" . file "baz" -- Just (E ()) --file :: FilePath -> IndexedTraversal' FilePath Layout Layout -- | Target Layout under the current Layout top if it happens -- to be a directory -- --
-- >>> layout ^? directory "foo" -- Nothing -- -- >>> layout ^? directory "bar" -- Just (F "baz" (E ()) (F "quux" (T "something" ()) (E ()))) --directory :: FilePath -> IndexedTraversal' FilePath Layout Layout -- | Target Layout under the current Layout top -- --
-- >>> layout ^? node "foo" -- Just (T "not empty" ()) -- -- >>> layout ^? node "bar" -- Just (F "baz" (E ()) (F "quux" (T "something" ()) (E ()))) -- -- >>> layout ^? node "what" -- Nothing --node :: FilePath -> IndexedTraversal' FilePath Layout Layout -- | Language to express directory layouts module System.Directory.Layout -- | A representation of directory layouts -- -- Invariants: -- --
-- % tree -- . ---- -- and you've written simple layout: -- --
-- layout = do -- directory "baz" $ -- file_ "twey" -- directory "foo" $ do -- directory "bar" $ do -- file_ "quuz" -- file_ "tatata" -- file_ "quux" ---- -- then running it should result in this directory tree: -- --
-- % tree -- . -- ├── baz -- │ └── twey -- └── foo -- ├── bar -- │ ├── quuz -- │ └── tatata -- └── quux --make :: Layout -> FilePath -> IO [LayoutException] -- | Check directory layout agrees with specified one -- -- For example, suppose there is a tree: -- --
-- % tree -- . -- ├── baz -- │ └── twey -- └── foo -- ├── bar -- │ ├── quuz -- │ └── tatata -- └── quux ---- -- then you can write: -- --
-- layout = do -- directory "baz" $ -- file_ "twey" -- directory "foo" $ do -- directory "bar" $ do -- file_ "quuz" -- file_ "tatata" -- file_ "quux" ---- -- and running check layout "." should result in [] check :: Layout -> FilePath -> IO [LayoutException] -- | Information about cought exceptions in various routines data LayoutException -- | createDirectory exceptions CD :: IOErrorType -> FilePath -> LayoutException -- | createFile eceptions CF :: IOErrorType -> FilePath -> LayoutException -- | fileExists eceptions FE :: IOErrorType -> FilePath -> LayoutException -- | directoryExists eceptions DE :: IOErrorType -> FilePath -> LayoutException -- | readFile eceptions RF :: IOErrorType -> FilePath -> Text -> LayoutException