summaryrefslogtreecommitdiff
path: root/main/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'main/Main.hs')
-rw-r--r--main/Main.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/main/Main.hs b/main/Main.hs
index 8d135d5..604d58f 100644
--- a/main/Main.hs
+++ b/main/Main.hs
@@ -628,8 +628,10 @@ instance MonadStorage CommandM where
instance MonadHead LocalState CommandM where
updateLocalHead f = do
- h <- gets csHead
- (Just h', x) <- maybe (fail "failed to reload head") (flip updateHead f) =<< reloadHead h
+ h <- maybe (fail "failed to reload head") return =<< reloadHead =<< gets csHead
+ ( Just h', x ) <- updateHead' h $ \h' -> do
+ modify $ \s -> s { csHead = h' }
+ f (headStoredObject h')
modify $ \s -> s { csHead = h' }
return x