LIB: improve documentation

This commit is contained in:
Julian Ospald 2015-12-21 18:39:30 +01:00
parent 773cb100b4
commit da32ccf619
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
1 changed files with 8 additions and 4 deletions

View File

@ -379,10 +379,11 @@ executeFile prog' args = do
--------------------
-- |Carry out action 1 if the filepath is a symlink, otherwise action2.
-- |Carries out the given action if the filepath is a symlink. If not,
-- carries out an alternative action.
onSymlinkOr :: FilePath
-> IO () -- ^ action1
-> IO () -- ^ action2
-> IO () -- ^ action if symlink
-> IO () -- ^ action if not symlink
-> IO ()
onSymlinkOr fp a1 a2 = do
isSymlink <- PF.isSymbolicLink <$> PF.getSymbolicLinkStatus fp
@ -395,7 +396,10 @@ onSymlinkOr fp a1 a2 = do
-- The operation may fail with:
--
-- * `throwFileDoesNotExist` if the filepath is neither a file or directory
onDirOrFile :: FilePath -> IO () -> IO () -> IO ()
onDirOrFile :: FilePath
-> IO () -- ^ action if directory
-> IO () -- ^ action if file
-> IO ()
onDirOrFile fp' iod iof = do
fp <- canonicalizePath' fp'
isD <- doesDirectoryExist fp