diff options
author | Joey Hess <joey@kitenet.net> | 2013-03-11 13:52:06 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-03-11 13:55:36 -0400 |
commit | 893860527ee8044cf990abaf03bf0405ff1ddd53 (patch) | |
tree | 7fca45b576b5913d2e8556950ccef844dd32a92e /Assistant/Types | |
parent | 71cd744329491c7480bbf168c5f4630037d30688 (diff) |
fix changeFile to not be partial
That led to runtime crashes, without even a warning from -Wall. Yipes!
Diffstat (limited to 'Assistant/Types')
-rw-r--r-- | Assistant/Types/Changes.hs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Assistant/Types/Changes.hs b/Assistant/Types/Changes.hs index ee797b8fe..9f0aad7a7 100644 --- a/Assistant/Types/Changes.hs +++ b/Assistant/Types/Changes.hs @@ -24,15 +24,18 @@ changeInfoKey _ = Nothing type ChangeChan = TSet Change +newChangeChan :: IO ChangeChan +newChangeChan = atomically newTSet + data Change = Change { changeTime :: UTCTime - , changeFile :: FilePath + , _changeFile :: FilePath , changeInfo :: ChangeInfo } | PendingAddChange { changeTime ::UTCTime - , changeFile :: FilePath + , _changeFile :: FilePath } | InProcessAddChange { changeTime ::UTCTime @@ -40,8 +43,10 @@ data Change } deriving (Show) -newChangeChan :: IO ChangeChan -newChangeChan = atomically newTSet +changeFile :: Change -> FilePath +changeFile (Change _ f _) = f +changeFile (PendingAddChange _ f) = f +changeFile (InProcessAddChange _ ks) = keyFilename ks isPendingAddChange :: Change -> Bool isPendingAddChange (PendingAddChange {}) = True @@ -54,7 +59,7 @@ isInProcessAddChange _ = False finishedChange :: Change -> Key -> Change finishedChange c@(InProcessAddChange { keySource = ks }) k = Change { changeTime = changeTime c - , changeFile = keyFilename ks + , _changeFile = keyFilename ks , changeInfo = AddChange k } finishedChange c _ = c |