summaryrefslogtreecommitdiff
path: root/src/compiler/GF/System
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2014-08-20 17:47:08 +0000
committerhallgren <hallgren@chalmers.se>2014-08-20 17:47:08 +0000
commit21f429caf8c8cb4248457c16abaf0ad4f51c974a (patch)
tree558898049275da72a5b2c37101368a68fa5e60de /src/compiler/GF/System
parent73310add9a549b58381f475eab5324a17a6b83dd (diff)
Add lifted directory operations in GF.System.Directory to eliminate the need for liftIO in various places
Diffstat (limited to 'src/compiler/GF/System')
-rw-r--r--src/compiler/GF/System/Directory.hs18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/compiler/GF/System/Directory.hs b/src/compiler/GF/System/Directory.hs
index 3ee1f3550..3cd8a8ef6 100644
--- a/src/compiler/GF/System/Directory.hs
+++ b/src/compiler/GF/System/Directory.hs
@@ -1,7 +1,19 @@
-- | Isolate backwards incompatible library changes to 'getModificationTime'
-module GF.System.Directory(getModificationTime,module D) where
+-- and provide lifted versions of some directory operations
+module GF.System.Directory(module GF.System.Directory,module D) where
+import Control.Monad.Trans(MonadIO(..))
import qualified System.Directory as D
-import System.Directory as D hiding (getModificationTime)
+import System.Directory as D
+ hiding (doesDirectoryExist,doesFileExist,getModificationTime,
+ getCurrentDirectory,getDirectoryContents,removeFile)
import Data.Time.Compat
-getModificationTime path = fmap toUTCTime (D.getModificationTime path)
+doesDirectoryExist path = liftIO $ D.doesDirectoryExist path
+doesFileExist path = liftIO $ D.doesFileExist path
+getModificationTime path = liftIO $ fmap toUTCTime (D.getModificationTime path)
+getDirectoryContents path = liftIO $ D.getDirectoryContents path
+
+getCurrentDirectory :: MonadIO io => io FilePath
+getCurrentDirectory = liftIO D.getCurrentDirectory
+
+removeFile path = liftIO $ D.removeFile path \ No newline at end of file