Safe Haskell | None |
---|
Language to express directory layouts
- data Node a
- type Layout = Node ()
- file :: FilePath -> Text -> Layout
- file_ :: FilePath -> Layout
- directory :: FilePath -> Layout -> Layout
- directory_ :: FilePath -> Layout
- fromDirectory :: FilePath -> IO (Either IOException Layout)
- make :: Layout -> FilePath -> IO [LayoutException]
- check :: Layout -> FilePath -> IO [LayoutException]
- data LayoutException
Layout declaration
A representation of directory layouts
Invariants:
Monad Node | All this crazy stuff is only to get do-notation basically. Bind ( |
Functor Node | |
Applicative Node | |
Foldable Node | |
Traversable Node | |
Apply Node | |
Bind Node | |
Eq a => Eq (Node a) | |
Ord a => Ord (Node a) | |
Read a => Read (Node a) | |
Show a => Show (Node a) | |
Default a => Monoid (Node a) | |
Default a => Default (Node a) | |
Semigroup (Node a) |
directory_ :: FilePath -> LayoutSource
Declare empty directory
Layout construction
fromDirectory :: FilePath -> IO (Either IOException Layout)Source
Create layout from directory
Canonicalizes path before traversing, generally understands only regular files and directories and ignores anything else it could not understand
Layout traverses
:: Layout | |
-> FilePath | Root directory |
-> IO [LayoutException] | List of warnings |
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
:: Layout | |
-> FilePath | Root directory |
-> IO [LayoutException] | List of failures |
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 []
Errors
data LayoutException Source
Information about cought exceptions in various routines
CD IOErrorType FilePath |
|
CF IOErrorType FilePath |
|
FE IOErrorType FilePath |
|
DE IOErrorType FilePath |
|
RF IOErrorType FilePath Text |
|