-- 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.3.1.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 -- | Representation of directory layouts -- -- Invariants: -- -- data DL a -- | Emptyness, nothing found here E :: !a -> DL a -- | File contents T :: !Text -> !a -> DL a -- | File node F :: !FilePath -> !Layout -> !(DL a) -> DL a -- | Directory node D :: !FilePath -> !Layout -> !(DL a) -> DL a -- | Type synonym to save some acrobatics type Layout = DL () instance Show a => Show (DL a) instance Read a => Read (DL a) instance Eq a => Eq (DL a) instance Ord a => Ord (DL a) instance Traversable DL instance Foldable DL instance Monad DL instance Bind DL instance Applicative DL instance Apply DL instance Functor DL instance Default a => Monoid (DL a) instance Semigroup (DL a) instance Default a => Default (DL a) -- | Layout traverses module System.Directory.Layout.Traverse -- | Make layout as specified -- -- For example, suppose you are in an empty directory -- --
--   % 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 DL module System.Directory.Layout.Lens -- | Get Text out of the current Layout (if possible) -- --
--   >>> layout ^? text
--   Nothing
--   
--   >>> layout ^? file "foo" . text
--   Just "not empty"
--   
--   >>> layout ^? directory "bar" . file "quux" . text
--   Just "something"
--   
text :: Prism Layout Layout Text Text -- | Look into the file in the current Layout (if possible) -- --
--   >>> layout ^? file "biz"
--   Nothing
--   
--   >>> layout ^? file "swaks"
--   Just (E ())
--   
--   >>> layout ^? directory "bar" . file "baz"
--   Just (E ())
--   
file :: FilePath -> IndexedTraversal' FilePath Layout Layout -- | Go into the directory in the current Layout (if possible) -- --
--   >>> layout ^? directory "foo"
--   Nothing
--   
--   >>> layout ^? directory "bar"
--   Just (F "baz" (E ()) (F "quux" (T "something" ()) (E ())))
--   
directory :: FilePath -> IndexedTraversal' FilePath Layout Layout -- | Language to express directory layouts module System.Directory.Layout -- | Representation of directory layouts -- -- Invariants: -- -- data DL a -- | Type synonym to save some acrobatics type Layout = DL () -- | Declare file with specified contents file :: FilePath -> Text -> Layout -- | Declare empty file file_ :: FilePath -> Layout -- | Declare directory with specified listing directory :: FilePath -> Layout -> Layout -- | Declare empty directory directory_ :: FilePath -> Layout -- | Make layout as specified -- -- For example, suppose you are in an empty directory -- --
--   % 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