Better field names for SymbolDb

This commit is contained in:
Daniel Gröber 2016-01-09 22:23:20 +01:00
parent 8b5bd1ae2b
commit bae40cb614
1 changed files with 6 additions and 6 deletions

View File

@ -52,8 +52,8 @@ import Prelude
type Symbol = String type Symbol = String
-- | Database from 'Symbol' to \['ModuleString'\]. -- | Database from 'Symbol' to \['ModuleString'\].
data SymbolDb = SymbolDb data SymbolDb = SymbolDb
{ table :: Map Symbol [ModuleString] { sdTable :: Map Symbol [ModuleString]
, timestamp :: ModTime , sdTimestamp :: ModTime
} deriving (Generic) } deriving (Generic)
instance Binary SymbolDb instance Binary SymbolDb
@ -61,7 +61,7 @@ instance NFData SymbolDb
isOutdated :: IOish m => SymbolDb -> GhcModT m Bool isOutdated :: IOish m => SymbolDb -> GhcModT m Bool
isOutdated db = isOutdated db =
isOlderThan (timestamp db) <$> timedPackageCaches isOlderThan (sdTimestamp db) <$> timedPackageCaches
---------------------------------------------------------------- ----------------------------------------------------------------
@ -76,7 +76,7 @@ lookupSymbol :: IOish m => Symbol -> SymbolDb -> GhcModT m String
lookupSymbol sym db = convert' $ lookupSym sym db lookupSymbol sym db = convert' $ lookupSym sym db
lookupSym :: Symbol -> SymbolDb -> [ModuleString] lookupSym :: Symbol -> SymbolDb -> [ModuleString]
lookupSym sym db = M.findWithDefault [] sym $ table db lookupSym sym db = M.findWithDefault [] sym $ sdTable db
--------------------------------------------------------------- ---------------------------------------------------------------
@ -97,8 +97,8 @@ dumpSymbol = do
ts <- liftIO getCurrentModTime ts <- liftIO getCurrentModTime
st <- runGmPkgGhc getGlobalSymbolTable st <- runGmPkgGhc getGlobalSymbolTable
liftIO . BS.putStr $ encode SymbolDb { liftIO . BS.putStr $ encode SymbolDb {
table = M.fromAscList st sdTable = M.fromAscList st
, timestamp = ts , sdTimestamp = ts
} }
-- | Check whether given file is older than any file from the given set. -- | Check whether given file is older than any file from the given set.