Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.PureScript.Make.Cache
Synopsis
- data ContentHash
- hash :: ByteString -> ContentHash
- type CacheDb = Map ModuleName CacheInfo
- newtype CacheInfo = CacheInfo {
- unCacheInfo :: Map FilePath (UTCTime, ContentHash)
- checkChanged :: Monad m => CacheDb -> ModuleName -> FilePath -> Map FilePath (UTCTime, m ContentHash) -> m (CacheInfo, Bool)
- removeModules :: Set ModuleName -> CacheDb -> CacheDb
- normaliseForCache :: FilePath -> FilePath -> FilePath
Documentation
data ContentHash #
Defines the hash algorithm we use for cache invalidation of input files.
Instances
FromJSON ContentHash # | |
Defined in Language.PureScript.Make.Cache | |
ToJSON ContentHash # | |
Defined in Language.PureScript.Make.Cache Methods toJSON :: ContentHash -> Value # toEncoding :: ContentHash -> Encoding # toJSONList :: [ContentHash] -> Value # toEncodingList :: [ContentHash] -> Encoding # omitField :: ContentHash -> Bool # | |
Show ContentHash # | |
Defined in Language.PureScript.Make.Cache Methods showsPrec :: Int -> ContentHash -> ShowS # show :: ContentHash -> String # showList :: [ContentHash] -> ShowS # | |
Eq ContentHash # | |
Defined in Language.PureScript.Make.Cache | |
Ord ContentHash # | |
Defined in Language.PureScript.Make.Cache Methods compare :: ContentHash -> ContentHash -> Ordering # (<) :: ContentHash -> ContentHash -> Bool # (<=) :: ContentHash -> ContentHash -> Bool # (>) :: ContentHash -> ContentHash -> Bool # (>=) :: ContentHash -> ContentHash -> Bool # max :: ContentHash -> ContentHash -> ContentHash # min :: ContentHash -> ContentHash -> ContentHash # |
hash :: ByteString -> ContentHash #
type CacheDb = Map ModuleName CacheInfo #
A CacheInfo contains all of the information we need to store about a particular module in the cache database.
Constructors
CacheInfo | |
Fields
|
Instances
FromJSON CacheInfo # | |
Defined in Language.PureScript.Make.Cache | |
ToJSON CacheInfo # | |
Monoid CacheInfo # | |
Semigroup CacheInfo # | |
Show CacheInfo # | |
Eq CacheInfo # | |
Ord CacheInfo # | |
checkChanged :: Monad m => CacheDb -> ModuleName -> FilePath -> Map FilePath (UTCTime, m ContentHash) -> m (CacheInfo, Bool) #
Given a module name, and a map containing the associated input files together with current metadata i.e. timestamps and hashes, check whether the input files have changed, based on comparing with the database stored in the monadic state.
The CacheInfo in the return value should be stored in the cache for future builds.
The Bool in the return value indicates whether it is safe to use existing build artifacts for this module, at least based on the timestamps and hashes of the module's input files.
If the timestamps are the same as those in the database, assume the file is unchanged, and return True without checking hashes.
If any of the timestamps differ from what is in the database, check the hashes of those files. In this case, update the database with any changed timestamps and hashes, and return True if and only if all of the hashes are unchanged.
removeModules :: Set ModuleName -> CacheDb -> CacheDb #
Remove any modules from the given set from the cache database; used when they failed to build.
normaliseForCache :: FilePath -> FilePath -> FilePath #
- Any path that is beneath our current working directory will be stored as a normalised relative path
- Any path that isn't will be stored as an absolute path