mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-24 03:52:50 -06:00
Eliminate the dependency on time-compat
It was only needed for compatibility with directory<1.2, but directory>=1.2 has been shipped with ghc since ghc-7.6. Note: time-compat-1.9.* (the current version) is a completely different package, that does not provide the needed function toUTCTime, which was provided in time-compat-0.1.*.
This commit is contained in:
2
gf.cabal
2
gf.cabal
@@ -142,7 +142,7 @@ Library
|
|||||||
|
|
||||||
---- GF compiler as a library:
|
---- GF compiler as a library:
|
||||||
|
|
||||||
build-depends: filepath, directory, time, time-compat,
|
build-depends: filepath, directory>=1.2, time,
|
||||||
process, haskeline, parallel>=3, json
|
process, haskeline, parallel>=3, json
|
||||||
|
|
||||||
hs-source-dirs: src/compiler
|
hs-source-dirs: src/compiler
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ import System.Directory as D
|
|||||||
doesDirectoryExist,doesFileExist,getModificationTime,
|
doesDirectoryExist,doesFileExist,getModificationTime,
|
||||||
getCurrentDirectory,getDirectoryContents,getPermissions,
|
getCurrentDirectory,getDirectoryContents,getPermissions,
|
||||||
removeFile,renameFile)
|
removeFile,renameFile)
|
||||||
import Data.Time.Compat
|
--import Data.Time.Compat
|
||||||
|
|
||||||
canonicalizePath path = liftIO $ D.canonicalizePath path
|
canonicalizePath path = liftIO $ D.canonicalizePath path
|
||||||
createDirectoryIfMissing b = liftIO . D.createDirectoryIfMissing b
|
createDirectoryIfMissing b = liftIO . D.createDirectoryIfMissing b
|
||||||
doesDirectoryExist path = liftIO $ D.doesDirectoryExist path
|
doesDirectoryExist path = liftIO $ D.doesDirectoryExist path
|
||||||
doesFileExist path = liftIO $ D.doesFileExist path
|
doesFileExist path = liftIO $ D.doesFileExist path
|
||||||
getModificationTime path = liftIO $ fmap toUTCTime (D.getModificationTime path)
|
getModificationTime path = liftIO $ {-fmap toUTCTime-} (D.getModificationTime path)
|
||||||
getDirectoryContents path = liftIO $ D.getDirectoryContents path
|
getDirectoryContents path = liftIO $ D.getDirectoryContents path
|
||||||
|
|
||||||
getCurrentDirectory :: MonadIO io => io FilePath
|
getCurrentDirectory :: MonadIO io => io FilePath
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import Data.Maybe(mapMaybe)
|
|||||||
import System.Directory (getModificationTime)
|
import System.Directory (getModificationTime)
|
||||||
import System.Mem(performGC)
|
import System.Mem(performGC)
|
||||||
import Data.Time (UTCTime,getCurrentTime,diffUTCTime)
|
import Data.Time (UTCTime,getCurrentTime,diffUTCTime)
|
||||||
import Data.Time.Compat (toUTCTime)
|
--import Data.Time.Compat (toUTCTime)
|
||||||
|
|
||||||
data Cache a = Cache {
|
data Cache a = Cache {
|
||||||
cacheLoad :: FilePath -> IO a,
|
cacheLoad :: FilePath -> IO a,
|
||||||
@@ -63,7 +63,7 @@ readCache' c file =
|
|||||||
Nothing -> do v <- newMVar Nothing
|
Nothing -> do v <- newMVar Nothing
|
||||||
return (Map.insert file v objs, v)
|
return (Map.insert file v objs, v)
|
||||||
-- Check time stamp, and reload if different than the cache entry
|
-- Check time stamp, and reload if different than the cache entry
|
||||||
readObject m = do t' <- toUTCTime `fmap` getModificationTime file
|
readObject m = do t' <- {-toUTCTime `fmap`-} getModificationTime file
|
||||||
now <- getCurrentTime
|
now <- getCurrentTime
|
||||||
x' <- case m of
|
x' <- case m of
|
||||||
Just (t,_,x) | t' == t -> return x
|
Just (t,_,x) | t' == t -> return x
|
||||||
|
|||||||
Reference in New Issue
Block a user