aboutsummaryrefslogtreecommitdiff
path: root/Assistant/Common.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-29 00:15:43 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-29 00:15:43 -0400
commit040f68d628120e112e22bfb7100f9650dec940c8 (patch)
tree7b0945f04cb23f09e8f2a77cf1c409cb058af84f /Assistant/Common.hs
parent9dd50063b98020add52672864922308ebb479280 (diff)
Assistant monad, stage 1
This adds the Assistant monad, and an AssistantData structure. So far, none of the assistant's threads run in the monad yet.
Diffstat (limited to 'Assistant/Common.hs')
-rw-r--r--Assistant/Common.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Assistant/Common.hs b/Assistant/Common.hs
index d6df77f69..a6c6b8935 100644
--- a/Assistant/Common.hs
+++ b/Assistant/Common.hs
@@ -14,8 +14,9 @@ module Assistant.Common (
) where
import Common.Annex as X
-import Assistant.DaemonStatus
+import Assistant.Monad as X
import Assistant.Alert
+import Assistant.DaemonStatus
import System.Log.Logger
import qualified Control.Exception as E
@@ -26,10 +27,10 @@ data NamedThread = NamedThread ThreadName (IO ())
debug :: ThreadName -> [String] -> IO ()
debug threadname ws = debugM threadname $ unwords $ (threadname ++ ":") : ws
-runNamedThread :: DaemonStatusHandle -> NamedThread -> IO ()
-runNamedThread dstatus (NamedThread name a) = go
+runNamedThread :: NamedThread -> Assistant ()
+runNamedThread (NamedThread name a) = liftIO . go =<< getAssistant daemonStatus
where
- go = do
+ go dstatus = do
r <- E.try a :: IO (Either E.SomeException ())
case r of
Right _ -> noop