record initial seed in sim log
Unless the log starts with a command that records a seed.
This commit is contained in:
parent
02f0996e25
commit
e568ac96b7
2 changed files with 7 additions and 2 deletions
|
@ -145,6 +145,10 @@ getSimLocations' = M.keysSet . M.filter present
|
||||||
addHistory :: SimState t -> SimCommand -> SimState t
|
addHistory :: SimState t -> SimCommand -> SimState t
|
||||||
addHistory st c = st { simHistory = c : simHistory st }
|
addHistory st c = st { simHistory = c : simHistory st }
|
||||||
|
|
||||||
|
recordSeed :: SimState t -> [SimCommand] -> SimState t
|
||||||
|
recordSeed st (CommandSeed _:_) = st
|
||||||
|
recordSeed st _ = addHistory st (CommandSeed (simRng st))
|
||||||
|
|
||||||
newtype RepoName = RepoName { fromRepoName :: String }
|
newtype RepoName = RepoName { fromRepoName :: String }
|
||||||
deriving (Show, Read, Eq, Ord)
|
deriving (Show, Read, Eq, Ord)
|
||||||
|
|
||||||
|
|
|
@ -94,8 +94,9 @@ start simfile = do
|
||||||
startup simdir st cs = do
|
startup simdir st cs = do
|
||||||
repobyname <- mkGetExistingRepoByName
|
repobyname <- mkGetExistingRepoByName
|
||||||
createAnnexDirectory (toRawFilePath simdir)
|
createAnnexDirectory (toRawFilePath simdir)
|
||||||
st' <- go st repobyname cs
|
let st' = recordSeed st cs
|
||||||
liftIO $ saveState st'
|
st'' <- go st' repobyname cs
|
||||||
|
liftIO $ saveState st''
|
||||||
|
|
||||||
go st _ [] = return st
|
go st _ [] = return st
|
||||||
go st repobyname (c:cs) = do
|
go st repobyname (c:cs) = do
|
||||||
|
|
Loading…
Reference in a new issue