diff options
| author | Sergei Trofimovich <slyfox@community.haskell.org> | 2013-03-09 21:38:43 +0000 |
|---|---|---|
| committer | Sergei Trofimovich <slyfox@community.haskell.org> | 2013-03-09 21:38:43 +0000 |
| commit | 0173b5f4ff1bb1aa07b15c441533a309036c8864 (patch) | |
| tree | 603afbd7e0400fe813bf223341f8e2c9f5a5b0e1 /src/server/Cache.hs | |
| parent | 576b19aab5ff16b44c70e5b1d77bc65190dac056 (diff) | |
ghc-7.6: allow directory-1.2
Get rid of old-time depend (and ClockTime in favour of UTCTime).
time-compat helps to retain backward compatibility with directory-1.1
and lower.
Diffstat (limited to 'src/server/Cache.hs')
| -rw-r--r-- | src/server/Cache.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/server/Cache.hs b/src/server/Cache.hs index c99f212e3..d704fe495 100644 --- a/src/server/Cache.hs +++ b/src/server/Cache.hs @@ -4,11 +4,12 @@ import Control.Concurrent.MVar import Data.Map (Map) import qualified Data.Map as Map import System.Directory (getModificationTime) -import System.Time (ClockTime) +import Data.Time (UTCTime) +import Data.Time.Compat (toUTCTime) data Cache a = Cache { cacheLoad :: FilePath -> IO a, - cacheObjects :: MVar (Map FilePath (MVar (Maybe (ClockTime, a)))) + cacheObjects :: MVar (Map FilePath (MVar (Maybe (UTCTime, a)))) } newCache :: (FilePath -> IO a) -> IO (Cache a) @@ -27,7 +28,7 @@ readCache c file = Nothing -> do v <- newMVar Nothing return (Map.insert file v objs, v) -- Check time stamp, and reload if different than the cache entry - readObject m = do t' <- getModificationTime file + readObject m = do t' <- toUTCTime `fmap` getModificationTime file x' <- case m of Just (t,x) | t' == t -> return x _ -> cacheLoad c file |
